Events

Contents

Overview

Note: This topic is for legacy Social Sharing v2 support only. For all new integrations, please see the current Social Sharing documentation.

The Janrain Social Sharing solution supports client-side handling of a number of events. These are useful for making customizations-based information gathered at run time, and for using third-party analytics to track specific events.

Registering Event Handlers

To handle events generated by Social Sharing, define the function janrainShareOnload. The UI will call this function when it is loaded, making it a good place to register event handlers. Each event object provides an addHandler function for this purpose.

Example Event Handler

Supported Events

The following fields in the janrain.events object define events:

Object Description Event Handler Parameter
onShareCustomizationChange Occurs when a qualified function is called, including: setProviders, setProvidersEmail, setModes, setMobile, setOrientation, setMessage, setTitle, setUrl, setDescription, setImage, and every Style function. An object containing the following fields:

  • defaults − object of every setting
  • setting − the current setting of the function.
onShareLoginStart Occurs when the user selects a provider or return experience button from the UI.
  • provider − returns the provider name.
onShareLoginError Occurs when encountering an error during logging in to Social Sharing.
  • provider − returns the provider name.
  • widget_type − returns the type of solution (for example, auth or share).
onShareLoginCancel Occurs when a user closes the provider’s sign-in popup.
  • provider − returns the provider name.
  • widget_type − returns the type of solution (for example, auth or share).
onShareLoginToken Returns the user token (which may be used in conjunction with other API features).
  • token − returns the user token.
  • janrainWidgetParameters − an object that returns both widget_type and provider.
onShareLoginComplete Occurs once the user has successfully selected an identity provider to use for sharing the activity.
  • provider − returns the provider name.
onShareContactImportStart Occurs when an identity provider begins transferring a user’s contact list to the client website.
  • provider − returns the provider name.
onShareContactImportError Occurs when an identity provider encounters an error during the process of transferring a user’s contact list to the client website.
  • message − returns the error message generated by the import.
onShareContactImportComplete Occurs when an identity provider has completed transferring a user’s contact list to the client website.
  • provider − returns the provider name.
  • contacts − an array of objects containing information describing the user’s contacts. Information includes provider, username, image location, and so on.
onShareUserInfoImportError Occurs when an identity provider encounters an error while transferring user information to the client website.
  • message − returns the error message generated by the import.
onShareUserInfoImportComplete Occurs when an identity provider has successfully completed transferring user information to the client website.
  • provider − returns the provider name.
  • name − returns the user name.
  • image − URL of user image.
  • email − user email address.
onShareLogoutStart Occurs when a user chooses to exit Social Sharing.
  • provider − returns the provider name.
onShareLogoutComplete Occurs when the user has successfully exited Social Sharing.
  • provider − returns the provider name.
onShareSendStart Occurs once the solution has initiated sending sharing information to the identity provider.
  • provider − returns the provider name.
  • mode − returns the sharing mode of “email,” “contact,” or “broadcast.”
  • contacts − an array of objects containing information describing the user’s contacts. Information includes provider, username, image location, and so on.
  • title − title of the shared content.
  • url − additional URL associated with the shared content.
  • description – returns the text describing the shared content.
  • message − returns the user generated content.
  • image − URL pointing to the image associated with the shared content.
  • media − URL pointing to the media associated with the shared content.
  • actionLink − returns the name and link to the shared content.
onShareSendError Occurs if Social Sharing encounters an error while sending sharing information to the identity provider.
  • provider − returns the provider name.
  • mode − returns the sharing mode of “email,” “contact,” or “broadcast”.
  • results − provides an object that details the failure and contains the error code and description.
  • success − returns false.
onShareSendComplete Returns a receipt of the shared information from the identity provider.
  • provider − returns the provider name.
  • mode − returns the sharing mode of “email,” “contact”, or “broadcast”.
  • results − provides an object that details the failure, and contains the error code and description. Note: In “contact” mode, the recipientId handler returns ID numbers for contacts.
  • success − returns false.
onShareContactSelect Occurs once the user selects a contact from the user’s contact list.
  • provider − returns the provider name.
  • contact − returns a hash of information describing the user contact. Information includes provider, username, image location, and other fields depending on the provider.
onShareContactUnselect Occurs once the user de-selects a contact from the user’s contact list.
  • provider − returns the provider name.
  • contact − returns a hash of information describing the user contact. Information includes provider, username, image location, and other fields depending on the provider.
onShareProviderSelect Occurs once the user selects a provider.
  • provider − returns the provider name.
onShareInputMessage Occurs on the keyup event as a user is entering a message in the message text area.
  • provider − returns the provider name.
  • message − returns the user-generated text in the message text box.
onShareEmailDirect Occurs when the user clicks the Send email directly link when sharing via email.
  • provider − returns the provider name.
  • message − returns the user-generated text in the message text box.
onShareReturnExperienceFound Occurs when Social Sharing loads and finds a relevant cookie stating which providers were last used. This event fires once for each provider that has a return experience.
  • provider − returns the provider name.
  • image − URL pointing to the image associated with the shared content.
  • name − returns the user name.
onModalOpen Fires when the modal window opens. None
onModalClose Fires when the modal window closes. None
onProviderLoginCancel Occurs when the end user clicks Cancel or No Thanks on the login screen. Some identity providers do not include a Cancel button or their cancel message does not get passed to Social Login. You may encounter issues with these providers:

  • AOL
  • Disqus
  • Flickr
  • Foursquare
  • Linkedin
  • LiveJournal
  • Renren
  • Tumblr
  • Twitter
  • Verisign
  • WordPress
  • Yahoo!
This event is fired from inside the cancelLogin call.
onProviderLoginComplete Occurs when the sign-in process is complete (whether successful or not). None
onProviderLoginError Occurs when encountering an error during the sign-in process. An object containing the following fields:

  • err − Error object
    • code − Numeric error code
    • msg − Descriptive error string
  • origin − Origin of sign-in error
  • stat − Status message
onProviderLoginStart Occurs when the user clicks the provider or return experience button, beginning the sign-in process. Object with a single field (indicating provider chosen).
onProviderLoginSuccess Occurs when the user successfully signs in. None
onProviderLoginToken Occurs when the user successfully signs in, and the tokenAction setting is true. A response object containing a single token field (which contains the one-time token).
onProviderLogoutComplete Fires when the user successfully signs out. Object with a single field (which indicates provider).
onProviderLogoutStart Fires when the user begins the sign-out process. Object with a single field (which indicates provider).