Integrating SiteSpect with GA4 using GTM

The following document describes how to send SiteSpect WATTS data to GA4 using Google Tag Manager with each page_view event

Step 1: Set up a WATTS Global Site Variation in SiteSpect to populate script variables

Triggers and Search Criteria

Replacement HTML

<head>
<script>
  var ss_campaigns="__SS_LISTCAMPAIGNCOUNTED{__SS_TCID__:__SS_VGID__}{,}__";
  var ss_guid="__SS_GUID__";
  var ss_vars="__SS_LISTVAR{__SS_VGID__:__SS_VID__}{;}__";
</script>

Notes:

  • Under Advanced Settings > Apply Based on Campaign Assignment > Test traffic only (and user is counted)
  • SS_LISTCAMPAIGNCOUNTED is the most common macro. See all WATTS macros for more.
  • Please work with your SiteSpect Team to determine the best SiteSpect settings and data to send to GA.

Step 2: Create Google Tag Manager Tags and Variables

There are three tags and three variables you need to create.

Tags

  1. Create a New tag and name it "Google Analytics GA4 Configuration".
    Select Google Analytics: GA4 Configuration for the Tag Type
    Select Initialization - All Pages for Triggering
    Screenshot from 2022-08-17 14-33-56
  2. Create a New tag and name it "SiteSpect WATTS dataLayer".
    Select Custom HTML for the Tag Type
    Paste in the script block
    Select All Pages for Triggering


    <script>
    var ssdl = window.dataLayer || [];
    ssdl.push({
    'event': 'sitespect-watts',
    'sscampaigns': ss_campaigns,
    'ssguid': ss_guid,
    'ssvars': ss_vars
    });
    </script>
  3. Create the three Variables as shown below prior to creating the final tag.

    Create a New tag and name it "SiteSpect WATTS Event".
    Select Google Analytics: GA4 Event for the Tag Type
    Use the existing Configuration Tag
    Set the Event Name to the same as used in the dataLayer
    Create an Event Parameter for each. The + icon to the right of the Value column should find each one that was created as a User-Defined Variable


    Configure a Trigger to use a Custom Event

Variables

  • Create a User-Defined Variable for each of the dataLayer event parameter key names.

Step 3: Create Custom Dimensions in GA4

  • Configure > Custom Definitions > Custom Dimensions > Create Custom Dimensions [button]
  • Create a Custom Dimension for each Event Parameter
  • Type in the Event Parameter (this will be an available field when creating a new Dimension)