Sending Events to Sitecore CDP & Personalize with Google Tag Manager

Category:
Icon 0
Icon Dec 3, 2023
Sending events to Sitecore Personalize/CDP with Google Tag Manager

An event in the context of web user actions refers to an action or occurrence typically triggered by a user interacting with a website or digital product. Examples include clicks, form submissions, page views, and page responses. Events are integral to digital analytics and digital marketing activities, forming the basis of our understanding of users’ digital experiences.

In the realm of digital experience analytics, an event-based model is arguably more crucial than ever. Google recently completed the evolution of its widely-used Analytics suite to Google Analytics 4 (GA4), entirely based on an event model of analytics rather than page view or session-based metrics.

Events play a pivotal role in Sitecore Engagement Cloud, where they are used as goals in Personalize. These goals, utilized within experiments and experiences, help determine the most effective optimization tactics for achieving the best business outcomes, such as conversion rates, order revenue, or custom goals. The goals are based on various events, and the Sitecore documentation outlines standard events expected by Personalize, including View, Identity, and Checkout, found here: https://doc.sitecore.com/personalize/en/developers/api/event-data-object.html

Additionally, Personalize allows configuration and tracking of custom events tailored to your specific digital product. Typically, developers handle the configuration and coding of these events into the frontend of the digital property. However, businesses often find their event tracking needs evolving over time. To address this, digital marketers require a way to add and configure events using no-code tools.

Enter Google Tag Manager (GTM). GTM enables the addition of any type of event to a site based on user interaction, offering powerful tools for triggering event tags using an extensive and configurable suite of options.

To create a custom event in GTM, ensure that the Engage SDK script is added to the page with the required context, as outlined in the instructions found here: https://doc.sitecore.com/personalize/en/developers/api/integrate-engage-sdk-and-google-tag-manager.html

Once the Engage object is available, create a new Custom HTML tag and add the provided script tag.

<script>
  if (window.engage) {
    window.engage.event(
      'CUSTOM_EVENT',
      {
        channel: 'WEB',
        currency: 'USD',
        language: 'en',
        page: {{Page URL}}
      },
      {
        value: 'Extension data value',
      }
    );
  }
</script>

In this example, the event is called ‘CUSTOM_EVENT’. You can set any required additional data in the extension data object. The data in this object is available in the event. In the example above, I am sending the value of ‘12345’. You can read more about the extension data object here: https://doc.sitecore.com/cdp/en/developers/api/extension-data-object.html

For Triggering, set the required trigger for your event. This may be a click on a specific button, a specific page view, link URL, element visibility… etc etc.

GTM, when combined with Sitecore Personalize and CDP, offers a flexible solution for implementing powerful digital analytics, enabling digital marketers to effectively track events and goals for optimization.