SiteSpect

Integrating FullStory with SiteSpect allows you to transfer information to use in solving problems, finding answers, and fine-tuning your customer experience. The instructions in this article are meant to provide a high-level framework through which you can design your own integration strategy.

Note: You will need sufficient permissions to implement code changes on your website.

Creating a Site Variation

A Site Variation is a SiteSpect Variation that applies to all campaigns and can be setup to apply only to users assigned to a campaign. When you create a Site Variation with the FullStory code, SiteSpect injects the code as part of all campaigns. To begin, follow these steps when logged into SiteSpect:

  1. Click New, then Global Variation.
  2. Enter a Name, such as FullStory Site Variation.
  3. Leave the Type set to Regular (the default).
  4. Select or create Tags as you need them.
  5. Leave the Scope set to Site (the default).
  6. Change the status to Active when you want this Site Variation to be applied.
    • The default status is Inactive.
  7. Open the Triggers area and click the + symbol at the right edge of the Triggers area.

    Screenshot_2023-01-12_at_4.35.12_PM.png
  8. Select Page Source and click Add.
    • SiteSpect adds the Page Source Trigger to the Triggers area of the page.
  9. In the Page Source field, enter </head>.
  10. Create a second Trigger by clicking the + sign again, but this time select Header.
  11. In the Header Name field, enter content type.
  12. In the Header Value field, enter html.

From here, there are two ways to continue. One method works for scenarios in which you’re implementing FullStory using SiteSpect. The second method works for implementing FullStory when using different tools.

Implementing FullStory Using SiteSpect

If you are implementing FullStory using SiteSpect:

  1. Log in to FullStory.
  2. Select Settings > FullStory Setup.
  3. Copy your data capture snippet.
  4. Paste the data capture snippet into a text editor and modify it as follows.
  5. Add the following below the line that says window['_fs_namespace'] = 'FS';
    window['_fs_ready'] = function() {
       setUserAssignments();
    };
    let appliedSsVariations = "__SS_LISTVAR{__SS_TCID__:__SS_VGID__:__SS_VID__:__SS_VNAME__}{;}__";
    let userCampaigns = "__SS_LISTCAMPAIGN{__SS_TCID__:__SS_TCNAME__:__SS_VGID__:__SS_VGNAME__}{;}__";
    
  6. Before the closing script, add:
    function sendFsEvent(assignmentString) {
       var stringSplit = assignmentString.split(':');
       var userCampaignID = stringSplit[0];
       var variationGroupID = stringSplit[1];
       var variationID = stringSplit[2];
       var variationName = stringSplit[3];
       var campaignName = "";
       var variationGroupName = "";
       if(userCampaignID !== "0"){
           var campaignsSplit = userCampaigns.split(';');
           for(let x = 0; campaignsSplit.length > x; x++){
               var currentCampaign = campaignsSplit[x].replace(';', '');
               var splitNames = currentCampaign.split(':');
               if(userCampaignID === splitNames[0]){
                   campaignName = splitNames[1];
                   if(variationGroupID === splitNames[2]){
                       variationGroupName = splitNames[3];
                   }
               }
           }
       }
       FS.event('SiteSpect Variation Applied', {
           campaignID: userCampaignID,
           campaignName: campaignName,
           variationGroupID: variationGroupID,
           variationGroupName: variationGroupName,
           variationID: variationID,
           variationName: variationName
       });
    }
    function setUserAssignments(){
       if(appliedSsVariations !== "") {
           var stringToSlice = appliedSsVariations;
           var assignmentCount = (stringToSlice.match(new RegExp(";", "g")) || []).length + 1;
           for (let x = 0; assignmentCount > x; x++) {
               if (stringToSlice.indexOf(":") > -1) {
                   var indexOfSemicolon = stringToSlice.indexOf(";");
                   if (indexOfSemicolon > -1) {
                       var sliceOfAssignments = stringToSlice.slice(0, indexOfSemicolon + 1);
                       stringToSlice = stringToSlice.replace(sliceOfAssignments, '');
                       sliceOfAssignments = sliceOfAssignments.replace(';', '');
                       sendFsEvent(sliceOfAssignments);
                   } else {
                       sendFsEvent(stringToSlice);
                   }
               }
           }
       }
    }
    
  7. In SiteSpect, open the Search & Replace area.
  8. In the Search Text field add </head>.
  9. In the Replacement Text field paste the script from the script editor and add </head> after it.
  10. Click Save at the bottom of the page.
    • When you set it to Active, it will run with all your Campaigns. 

Implementing FullStory Without SiteSpect

If you are implementing FullStory using a tool other than SiteSpect:

  1. In SiteSpect, open the Search & Replace area.
  2. In the Search Text field add </head>.
  3. In the Replacement Text field paste the script below.
<script>   
window['_fs_ready'] = function() { setUserAssignments(); }; let appliedSsVariations = "__SS_LISTVAR{__SS_TCID__:__SS_VGID__:__SS_VID__:__SS_VNAME__}{;}__"; let userCampaigns = "__SS_LISTCAMPAIGN{__SS_TCID__:__SS_TCNAME__:__SS_VGID__:__SS_VGNAME__}{;}__"; function sendFsEvent(assignmentString) { var stringSplit = assignmentString.split(':'); var campaignID = stringSplit[0]; var variationGroupID = stringSplit[1]; var variationID = stringSplit[2]; var variationName = stringSplit[3]; var campaignName = ""; var variationGroupName = ""; if(campaignID !== "0"){ var campaignsSplit = userCampaigns.split(';'); for(let x = 0; campaignsSplit.length > x; x++){ var currentCampaign = campaignsSplit[x].replace(';', ''); var splitNames = currentCampaign.split(':'); if(campaignID === splitNames[0]){ campaignName = splitNames[1]; if(variationGroupID === splitNames[2]){ variationGroupName = splitNames[3]; } } } } FS.event('SiteSpect Variation Applied', { campaignID: campaignID, campaignName: campaignName, variationGroupID: variationGroupID, variationGroupName: variationGroupName, variationID: variationID, variationName: variationName }); } function setUserAssignments(){ if(appliedSsVariations !== "") { var stringToSlice = appliedSsVariations; var assignmentCount = (stringToSlice.match(new RegExp(";", "g")) || []).length + 1; for (let x = 0; assignmentCount > x; x++) { if (stringToSlice.indexOf(":") > -1) { var indexOfSemicolon = stringToSlice.indexOf(";"); if (indexOfSemicolon > -1) { var sliceOfAssignments = stringToSlice.slice(0, indexOfSemicolon + 1); stringToSlice = stringToSlice.replace(sliceOfAssignments, ''); sliceOfAssignments = sliceOfAssignments.replace(';', ''); sendFsEvent(sliceOfAssignments); } else { sendFsEvent(stringToSlice); } } } } }
</script>
</head>

How it Works

The appliedSsVariations variable is set by a WATTS macro that pulls together a list of all variations applied on the page. SiteSpect adds both the variable and the WATTS data (including Campaign ID, Variation Group ID, Variation ID, and Variation name) to the page source. If there is no campaign or Variation Group associated with the variation, the ID is 0.

The userCampaigns variable is set by a WATTS macro that pulls together a list of all campaigns the user is assigned to.

Note: This is a list of campaigns the user is assigned to but not necessarily counted in.

The list from the macro contains the Campaign ID, Campaign Name, Variation Group ID, and Variation Group Name of all campaigns the user is assigned to.

The function setUserAssignments iterates through each variation applied to the page (campaign and non-campaign) that is listed in the appliedSsVariations variable and calls the sendFsEvent function.

The sendFsEvent function sends the variation information to FullStory using FS.event(). Prior to sending the variation information, the function checks to see if there is a campaign associated with the variation and if so, it locates the the Campaign name and Variation Group name associated with the current variation in the userCampaigns variable and adds it to the data before sending the variation information to FullStory.

Need to get in touch with us?

The FullStory Team awaits your every question.

Ask the Community Technical Support