Social Sharing JavaScript API: Global Settings

When the Social Sharing solution is initialized, it reads some or all of its settings from the janrain.settings object that you will include on each page where sharing is enabled. These settings are included in the JavaScript that is generated when you configure Social Sharing in the Janrain Dashboard.

You may modify these settings per instance of the sharing widget in order to customize the solution where needed. See the Instance Settings section for details on how to override these settings.

Example:


<script type="text/javascript">
 janrain.settings.social = {
 orientation:"vertical",
 providers:[
 "facebook",
 "twitter",
 "email"
 ]
 };
 janrain.settings.appUrl = "https://my-app.rpxnow.com";
 janrain.settings.language = "es-ES";
</script>

appUrl

Required string

The domain for this application. 

Note. If you are also using Social Login, janrain.settings.appUrl may already be defined on the page. If so, do not include it in the sharing configuration script.

language

Default: en-US string

The language to use for the Social Sharing UI. Note that for languages other than English, the number of characters in a share message is determined by the URL encoding for those characters.

Available language values:

Code

Language

ar

Arabic

bg-BG

Bulgarian

cs-CZ

Czech

da-DK

Danish

de-DE

German

el-GR

Greek (Modern)

en-US

English

es-ES

Spanish (Spain)

es-LA

Spanish (Latin America)

fi-FI

Finnish

fr-FR

French

he-IL

Hebrew

hr-HR

Croatian

hu-HU

Hungarian

id-ID

Indonesian

it-IT

Italian

ja-JP

Japanese

ko-KR

Korean

lt-LT

Lithuanian

my

Burmese

nb-NO

Norwegian

nl-BE

Dutch (Belgium)

nl-NL

Dutch (Netherlands)

pl-PL

Polish

pt-BR

Portuguese (Brazil)

pt-PT

Portuguese (Portugal)

ro-RO

Romanian

ru-RU

Russian

sk-SK

Slovak

sl-SI

Slovenian

sr

Serbian

sv-SE

Swedish

th-TH

Thai

tr-TR

Turkish

uk-UA

Ukranian

vi-VN

Vietnamese

zh-CHS

Chinese (Simplified)

zh-CHT

Chinese (Traditional)

social.cssUrl

string

The full URL path to a CSS resource to be used for styling the sharing widget.

social.formFactor

Default: bar
Overridden by: string

Available values are bar or drawer. Determines whether the widget’s provider buttons are displayed immediately or if they are hidden until a user clicks the Share button. This value may also be set on the social share HTML element (see the Instance Settings for details).

social.orientation

Default: horizontal
Overridden by: string

Available values are horizontal or vertical. Determines whether the widget’s provider buttons are displayed as a row or column. Recommend using vertical when right-aligning the sharing widget, and horizontal when bottom-aligning the sharing widget. This value may also be set on the social share HTML element (see the Instance Settings for details).

social.providers

Overridden by: array

List of comma-separated identity providers that may be used for sharing. See the sSocial Sharing Overview for more information on provider configuration. This value may also be set on the social share HTML element (see the Instance Settings for details).

Available provider values:

  • email-google (only for use with the Google OpenID provider)
  • email-mailto
  • email-yahoo
  • facebook
  • linkedin
  • mixi
  • native-facebook
  • native-linkedin
  • native-mixi
  • native-odnoklassniki
  • native-pinterest
  • native-reddit
  • native-sinaweibo
  • native-tumblr
  • native-twitter
  • native-vk
  • native-xing
  • qq
  • tencentweibo
  • twitter
  • xing

social.providerFormats

object

A nested JSON object with key/value pairs mapping a custom share messaging format to a named provider. The initial key is that of the provider (for example,facebook). The value is an object with nested key of a variable and a value of the custom message data.

Attributes that may be used as nested key variables are:

  • description
  • image
  • media
  • message
  • title
  • url

Example:


<script type="text/javascript">
 janrain.settings.social = {
 providerFormats:{
 twitter:{
 message:" - "
 },
 mixi:{
 message:" - "
 },
 }
 }
</script>

social.providerIcons

object

A JSON object with key/value pairs mapping a custom icon to a named provider. The key is that of the provider (for example, facebook). The value is the full URL to the image to use in place of Janrain’s default.


<script type="text/javascript">
 janrain.settings.social.providerIcons = {
 "facebook":"https://example.com/facebook.png",
 "native-facebook":"https://example.com/facebook2.png"
 };
</script>

social.shareCountMin

Default: -1
Overridden by: integer

Minimum number of shares before the ShareCount element should be displayed. (Note: The share count does not include those performed via native share methods.) The default value -1 will cause the ShareCount element to be immediately displayed, regardless of sharing activity. This value may also be set on the social share HTML element (see the Instance Settings for details).

social.shareCountMode

Default: none
Overridden by: string

Available values are none or combined. The share count will not be displayed by default. If set to combined, the share count combines Janrain shares with total provider shares. This value may also be set on the social share HTML element (see the Instance Settings for details).