Data layers offer a simple way to expose data for use by various applications and analytics tools. Exposing SiteSpect Campaign details in a data layer is a simple and efficient way to tie SiteSpect data with other systems.
Use the __SS_LISTCAMPAIGNCOUNTED{fmt}{delim} along with the following macros to pass SiteSpect data to an existing data layer or to populate a new one.
Macro | Data Type | Description |
---|---|---|
__SS_TCID__ | Integer | Campaign ID. The TestCampaign_ID listed in the URL when you are editing a Campaign or the ID visible in the tooltip when you hover over the Campaign on the Campaign List. |
__SS_VGID__ | Integer | Variation Group ID. The VariationGroup_ID listed in Summary View when you are editing a Campaign in the New Builder or the ID visible in the tooltip when you hover over the Variation Group Edit button in the Old Builder. |
Creating a New Data Layer Object
The following example creates a data layer object called ssWatts, which exposes the Campaign IDs and Variation IDs of visitors who are Assigned to and Counted in Campaigns in SiteSpect.
Create a Site Variation and use the following for the Search Text and Replacement Text fields.
Search Text:
</head>
Replacement Text:
<script language="JavaScript">
var ssWatts = [__SS_LISTCAMPAIGNCOUNTED{,}__];
</script>
</head>
Example Result:
<script language="JavaScript">
var ssWatts = [{
testCampaignID: 534,
variationGroupID: 4355
}, {
testCampaignID: 536,
variationGroupID: 4561
}];
</script>
</head>
Modifying an Existing Data Layer
The following is a simple example that appends SiteSpect Campaign data to an existing data layer. Create a Site Variation and use the following for the Search Text and Replacement Text fields.
Search Text:
</head>
Replacement Text:
<script language="JavaScript">
var ssWatts = [__SS_LISTCAMPAIGNCOUNTED{,}__];
digitalData.ssWatts = ssWatts;
</script>
</head>
Example Result:
<script language="JavaScript">
var ssWatts = [{
testCampaignID: 534,
variationGroupID: 4355
}, {
testCampaignID: 536,
variationGroupID: 4561
}];
digitalData.ssWatts = ssWatts;
</script>
</head>