Gigya Setup

Integrating Gigya’s Social Login

Gigya offers social media tools to online businesses helping them integrate their sites with social networks. If you’re a Gigya customer you can integrate directly with Sailthru to leverage a customer’s social data to display more relevant content that matches their interests.

Now you’ll be able to use smart lists to segment on social data. With information stored in the user profiles you’ll also be able to use our Zephyr scripting in emails to further refine your personalization by including data points from social networks.

Getting Started

Talk to your account manager at Gigya to enable social login on your account and select the providers you want to support.

Once you’ve got the social login feature enabled at Gigya contact your Sailthru account manager. We’ll help you create a callback script and provide some sample code to capture Gigya’s login event. Your Sailthru implementation team will need to know your technology stack to guide you with the callback script. Currently we are supporting PHP and Rails but can provide assistance with other languages as needed but these may take additional time during implementation.

You can download the required code libraries for integrating with PHP and Ruby from our GitHub repo. The example below shows a typical PHP example for adding the user’s profile via a User API call. The referenced include files are part of the GitHub repository and will need to be present in your script for the integration to work.

include_once 'config.api.php';
include_once './Gigya_PHP_SDK/GSSDK.php';
include_once '../src/php/sailthru/sailthru/Sailthru_Client.php';
include_once '../src/php/sailthru/sailthru/Sailthru_Client_Exception.php';
include_once '../src/php/sailthru/sailthru/Sailthru_Util.php';
include_once '../src/php/Sailthru_Social.php';

if ($_POST) {

    $client = new Sailthru_Social($api_key, $api_secret);
    $profile = json_decode($_POST['json']);

    // check the gigya security signature
    $uid = isset($profile->UID) ?  $profile->UID : '';
    $ts = isset($profile->signatureTimestamp) ?  $profile->signatureTimestamp : '';
    $sig = isset($profile->UIDSignature) ?  $profile->UIDSignature : '';
    $valid = SigUtils::validateUserSignature($uid, $ts, $gigya_secret_key, $sig);

    if ($valid) {
        $result = $client->social_login($profile);
        header('HTTPS/1.1 204 No Content');
    } else {
        header('HTTPS/1.1 405 Method Not Allowed');
    }
} else {
    header('HTTPS/1.1 405 Method Not Allowed');
}

Add the Javascript

Once the callback script and your Gigya account is set up you’ll need to add the following JavaScript snippet to your site. Remember the name of the callback script we used in the previous example. We’ll pass this to the JavaScript as the location of the callback URL. Whatever you choose to name your callback script needs to match the callback_url parameter. This should be passed over an TLS connection to ensure the encryption of the user profile data and also security best practices employed as referenced by the Gigya documentation.

<script src="https://ak.sail-horizon.com/gigya/sync.js"></script> 

<script type="text/javascript"> 
    SailthruGigya.callback_url = 'http://yourdomain.example.com/gigya-callback.php'; 
    gigya.socialize.addEventHandlers({ 
        onLogin:SailthruSync 
    }); 
</script>

What information is shared?

Gigya has a standard schema of user information that they share via the onLogin event. You can see the full schema here.

Different information is available from different services if the service does not provide the information in the schema or the user has not provided it then it will not be passed to Sailthru.

It’s important to note that this information is only information that the user has explicitly allowed a service to share.

After the data is passed to Sailthru it will become available in the user profile. The format for reference is servicename_variable.

As these are user variables, you will be able to use them in Audience Builder to generate reports and Smart Lists, opening up opportunities to further refine your lists to provide quality, relevant content for your users.

Top