Gigya Job Openings

Qualtrics

Skip to end of metadata
Go to start of metadata

Overview

The experience economy has changed the way businesses compete. Today, organizations must continuously evaluate insights from the day to day activities and operations ("what"), while listening to the beliefs, emotions, and intentions of customers, employees, suppliers, partners, and other stakeholders (understand the "why"). This type of data is called experience data, or X-data. Customer Data Cloud from Gigya and Qualtrics are both solutions offered by SAP: The first in the sphere of operational data "O", and the second in customer experience "X". SAP Customer Data Cloud specializes in identity and access management, building customer profiles via consent-based interactions. Together, an implementation that utilizes both platforms can leverage their strength, to help companies monitor customer interactions and identify opportunities for improvement. For example: 

  • From Survey to Identity: A customer completes a feedback form and is prompted to create an early stage account, capturing their consent for the channel through which they wish to receive communications. 
  • Customer Data Cloud Registration: Throughout a customer's brand journey (early stage, registered, progressively profiled), experience feedback can be collected for a product or service. At the point of request for feedback, customers have full visibility of their profile, preferences and consent, thus putting customers in control in a transparent, trust-building way. 
  • Delayed Feedback After Customer Interaction: Following a customer sign-up for a product or service, request feedback a few days later, with Customer Data Cloud used as the collection source of customer data. This allows the customer time to experience the product or service before asking for their feedback, making that input more accurate, authentic and valuable. 

This document outlines implementation suggestions for these use cases, by way of highlighting the many possible integration and implementation options. Note that implementations of Consent ManagementCustomer Identity and Lite Registration are documented separately - this guide focuses on the integration between SAP Customer Data Cloud and Qualtrics. 

These use cases have been implemented on this demo site. You can visit it and try these flows for yourself. 

In all the use cases outlined, and any others, behavioral data saved to Qualtrics can be synced to the user account saved on Customer Data Cloud, and then used in segmentation, marketing, progressive profiling or any other usage of Customer Data Cloud data. 

1. From Survey to Identity

In this example, a survey (valuable customer input following a customer interaction) is leveraged to create a lite identity, starting an unknown user on the customer journey to become a known, loyal customer. The survey data, saved originally to Qualtrics, can be used to populate the newly created lite account with valuable data. "Early registration" accounts are called Lite accounts on Customer Data Cloud.

Survey Configuration

 At the end of your Qualtrics survey, add a communication consent question, offering the user the option to sign up for an email subscription:

 

The subscription or consent text has to be copied manually from SAP Customer Data Cloud, into the Qualtrics survey.

Capturing the Early Stage Account in Customer Data Cloud

To trigger the Lite account creation in Customer Data Cloud, you will need to create an action in your Qualtrics Survey.

To do so: 

  1. Open the Actions menu: 

  2. Select Add Action
  3. Under Event, choose Survey Response
  4. Under Conditions, reference the question that captures the communication consent: 

  5. Add a Task, choose Web Service, and add the endpoint where the early stage account is created: 
     
    1. Enter the URL where the account is created. 
    2. Under Request, choose POST
    3. Under Content, choose JSON
    4. You can optionally add a header.
    5. For the data fields, you require at least a field for the email address being collected.
  6. The sample code below creates the early stage account. Following our Lite Registration Documentation, it calls accounts.initRegistration then accounts.setAccountInfo, passing the collected data points into the Customer Data Cloud Profile Object, and setting the "isSubscribed" status to "true" for the relevant subscription

    <?php
    
    
    include_once
    "./GSSDK.php";
    
    $apiKey = "xxxxxxxxxxxxxxxxx";
    
    $secretKey = "xxxxxxxxxxxxxxxxxxxxx";
    
    include_once('Crypt/RSA.php');
    
    $response;
    
    $data = file_get_contents('php://input');
    
    $json = json_decode($data, true);
    
    $email=$json['email'];
    
    $lastName=$json['lastName'];
    
    $firstName=$json['firstName'];
    
    $method = "accounts.initRegistration";
    
    $request = new GSRequest($apiKey,$secretKey,$method,null,true);
    
    $request->setCAFile(realpath("./cacert.pem"));
    
    $request->setApiDomain("xxx.gigya.com");
    
    $request->setParam("isLite", true);
    
    $response = $request->send();
    
    $json = json_decode($response->getResponseText(), true);
    
    //echo
    $json['regToken'];
    
    $method = "accounts.setAccountInfo";
    
    $requestA = new GSRequest($apiKey,$secretKey,$method,null,true);
    
    $requestA->setCAFile(realpath("./cacert.pem"));
    
    $requestA->setApiDomain("xxx.gigya.com");
    
    $requestA->setParam("regToken",
    $json[regToken]);
    
    $requestA->setParam("lang", "en");
    
    $requestA->setParam("preferences", '{"privacy":{"privacyID1":{"isConsentGranted":true}}}');
    
    $requestA->setParam("subscriptions", '{"weeklyNewsLetterTest1":{"email":{"isSubscribed":true}}}');
    
    $requestA->setParam("profile", '{firstName:"' . $firstName .'", lastName:"'. $lastName . '", email:"' . $email . '"}' );
    
    $responseA = $requestA->send();
    
    echo $responseA->getResponseText();
    
    $jsonA = json_decode($responseA->getResponseText(), true);
    
    http_response_code(200);
    
    ?>

Distributing the Survey to Customers

Once the Qualtrics Survey has been created, you can distribute to your customers in many ways. For example, you can generate a QR Code that can be appended to eReceipts, or physical receipts. Alternatively, an anonymous link can be provided. 

To generate a QR code, open the Distribution menu in Qualtrics and select QR Code, then download the code.

2. Customer Data Cloud Registration

In this scenario, following a user registration on your site (full registration), a standard Customer Data Cloud verification email is sent to the user, which includes a prompt to provide feedback about the registration process. This could help reveal and address unknown impediments in the process. The Qualtrics Feedback form is triggered using the Qualtrics REST API, allowing known user attributes associated to the authenticated user in Customer Data Cloud to be pre-populated in the feedback form, and only request users to provide missing data.  This makes it quicker and easier to complete feedback forms.

Set Up the Email Verification Template

  1. Open the Email Templates page of the Customer Data Cloud Console. 
  2. If you wish, edit the Verification Email template to reflect the flow of verification and survey completion: 

  3. Save your changes.

Configure Policies 

  1. Open the Policies page of the Customer Data Cloud Console. 
  2. Under Email Verification, set the flag to Require email verification.
  3. Under Customize redirection URL, specify the page on which the survey will be hosted.
  4. Make sure the following setting is flagged: Automatically login users upon email verification.
  5. Save your changes. 

 

Create a Survey

  1. Create a survey on your site that captures the survey questions. This will be hosted on the email verification page (to which the email verification link redirects). 
  2. Below is a sample code used when submitting the survey. Since the session is authenticated, attributes that are saved to the user's account. such as profile.email, are pre-populated in the form. The remaining fields are then captured from the user's input, before being posted to an endpoint that will make the Qualtrics API calls.

                    var str = location.search;
                    if (str.indexOf("hearAboutUs") >= 0)
                    {
                            var survey = mapURLParams(decodeURIComponent(str.substring(1)));
                            console.log(Response.profile.email);
                            console.log(survey['sex']);
                            console.log(survey['age']);
                            console.log(survey['hearAboutUs']);
                            console.log(survey['share']);
                            var surveyResponse = '{"advance": true, "responses" : { "QID9": {"' + survey['hearAboutUs'] + '" : {"selected": true}}, "QID10" : { "' + survey['share'] + '" : {"selected" : true}}, "QID7": "' + survey['sex'] + '", "QID6": "' + survey['age'] + '", "QID12" : "' + Response.profile.email + '"}}';
    
            var urlStr = 'https://stephen.gigya-cs.com/demo/qSubmit.php?email=' + encodeURI(Response.profile.email) + "&sex=" + survey['sex']  + "&age=" + survey['age'] + "&hearAboutUs=" + survey['hearAboutUs'] + "&share=" + survey['share'] + "&rate=" + survey['rate'];
            console.log(urlStr);
            $.ajax({
            type: "GET",
            accept: '*/*',
            url: urlStr,
            cache: false,
            crossDomain: true,
            contentType: "application/html; charset=utf-8; content-type: application/json",
            success: function(data) { console.log("succ"); } ,
            error: function(data) { console.log(data); console.log("err"); }
            });
                    window.location.href = "https://stephen.gigya-cs.com/demo/thenewport.html"
                    }
    
  3. Call the Qualtrics survey via their REST API. For example:

    <?php
    $email = $_GET['email'];
    $sex = $_GET['sex'];
    $age = $_GET['age'];
    $hearAboutUs = $_GET['hearAboutUs'];
    $share = $_GET['share'];
    $rate = $_GET['rate'];
    $jData = '{ "advance" : true, "responses" : { "QID14" : { "' . $rate .'": { "selected": true }}, "QID9" : { "' . $hearAboutUs .'": { "selected": true }}, "QID10" : { "' . $share . '": { "selected": true }}, "QID7" : "' . $age . '", "QID6" : "' . $sex . '", "QID12" : "' . urldecode($email) . '" } }';
    
    $data = array(
    'language' => 'EN'
    );
    $opts = array('http' =>
        array(
            'method'  => 'POST',
            'header'  => ['Content-type: application/json', 'X-API-TOKEN:xxxxxxxxxxxxxx'],
            'content' => json_encode($data)
        )
    );
    $context = stream_context_create($opts);
    $result = file_get_contents('https://sapdevelopment.qualtrics.com/API/v3/surveys/SV_XXXXXXXX/sessions', false, $context);
    $json = json_decode($result, true);
    
    $url = 'https://sapdevelopment.qualtrics.com/API/v3/surveys/SV_XXXXXXXX/sessions/' . $json['result']['sessionId'];
    $optsA = array('http' =>
        array(
            'method'  => 'POST',
            'header'  => ['Content-type: application/json', 'X-API-TOKEN:xxxxxxxxxxxxxxxxx'],
            'content' => $jData
        )
    );
    $contextA = stream_context_create($optsA);
    # Get the response (you can use this for GET)
    $resultA = file_get_contents($url, false, $contextA);
    $jsonA = json_decode($resultA, true);
    header('content-type: application/json');
    http_response_code(200);
    ?>
    

The survey responses can later be analyzed in Qualtrics: 

3. Delayed Feedback After Customer Interaction

After a user has consented to sign up for a service or email subscription, Customer Data Cloud notifies Qualtrics. Qualtrics then creates a Contact using the Customer Data Cloud profile attributes for a survey that can be triggered after a defined period of time. This allows the customer time to experience the product or service before asking for their feedback, making that input more accurate, authentic and valuable. 

Configure the Qualtrics Survey

Under Actions, Create a JSON event to receive inbound posts into Qualtrics. An endpoint will be created, to which you can then post your payload, and the JSON structure of the payload will be automatically identified.

You can then define the distribution rules of the survey. This is where you map the JSON fields, determine the contact list the user will be added to, the email format that will be sent to the user and the survey to be distributed for them to complete.

Create a Webhook

On the Customer Data Cloud side of the configuration, you will need to configure an "account updated" Webhook, and send the notification to a predefined endpoint. Your endpoint will then parse out the information required to determine if the user should be sent a survey.
Alternatively, use Extensions or the Generic API IdentitySync component. 

Sample Webhook configuration: 

Code Sample

After parsing the webhook, a call to accounts.getAccountInfo is required to get the user profile data. The attributes required to create the Qualtrics contact are then posted to a Qualtrics endpoint (generated by the previously created inbound action).

The sample code for handling the webhook event:

$loyaltyScheme = $json['data']['params']['preferences']['loyaltyScheme']['isConsentGranted'];
        $firstName = $json['data']['accountInfo']['profile']['firstName'];
        $lastName = $json['data']['accountInfo']['profile']['lastName'];
        $email = $json['data']['accountInfo']['profile']['email'];
        if($loyaltyScheme == true) {
                $jData = '{"firstName":"' . $firstName . '", "lastName":"' . $lastName . '", "email":"' . $email . '"}';
                fwrite($HANDLE, "\nloyaltyScheme". $loyaltyScheme . "\n");
                fwrite($HANDLE, "\njData". $jData . "\n");
                $url = 'https://ca1.qualtrics.com/inbound-event/v1/events/JSON/triggers?contextId=xxxxxxx&userId=xxxxxxx&brandId=xxxxxxxx&triggerId=xxxxxxxx';
                $optsA = array('http' =>
                array(
                        'method'  => 'POST',
                        'header'  => ['Content-type: application/json', 'X-API-TOKEN:xxxxxxxxxxx'],
                        'content' => $jData
                )
                );
                # Create the context
                $contextA = stream_context_create($optsA);
                # Get the response (you can use this for GET)
                //echo $url;
                $resultA = file_get_contents($url, false, $contextA);


                //echo $resultA;
                $jsonA = json_decode($resultA, true);
                fwrite($HANDLE, "\nresultA". $resultA . "\n");

        }

  • No labels