LogoLogo
Support
Front End Tracking
Front End Tracking
  • Introduction to front-end tracking
  • Setup guide
    • Prerequisites
    • FHR activities
    • XO Search activities
    • XO Recommendations activities
  • Implementation guide
    • SDK
    • Google Tag Manager
    • REST API
  • Identities
    • User object
    • Working with identities
  • Activities
    • Activity object
    • View
    • Click
    • Add to cart
    • Remove from cart
    • Purchase
    • Custom actions
  • AI Scores
    • Setup
    • Usage
  • Best practice
  • Data handling
  • Acronyms and abbreviations
Powered by GitBook

Copyright @ 2024 Crownpeak Technology, Inc. All rights reserved.

On this page
  • Prerequisites
  • GTM Templates
  • XO Activities Tracking
  • XO Multi-Activity Tracking
  1. Implementation guide

Google Tag Manager

Track user activities with Google Tag Manager using Crownpeak's provided GTM templates for streamlined front-end tracking implementation.

PreviousSDKNextREST API

Last updated 3 months ago

Use the provided Google Tag Manager (GTM) templates to track .

Prerequisites

  • Configured GTM container

  • Data layer containing the (if possible)

  • Tracker key

To obtain your tracker key(s), reach out to your Customer Support Manager.

GTM Templates

We provide the following two templates for use:

  • : Use for sending one activity event for each user action

  • : Use for sending mutiple activity events for a single user action

Access these templates by clicking the links above. Alternativey, in the , search for "XO Activities Tracking" or "XO Multi-Activities Tracking".

The XO templates are used for both FHR and XO.

XO Activities Tracking

The XO Activities Tracking template is the main template. Use this template to send one activity event for each user action:

  1. Add the template to your workspace.

  2. Using the New button in the Tag section, add a new tag.

  3. Select the XO Activities Tracking template. -> A configuration window opens.

  1. Add your tracker key in the assigned field.

  2. Choose an action. Each field corresponds to a variable, which means that you can configure multiple actions on the tag if your variable is dynamic. Otherwise, you should have an individual tag for each tracking action.

  3. Add one or more identities. An identity is a key-value pair. The key corresponds to the name of the identity (such as: "sessionId") and the value to the ID of that identity for the visitor (the actual session ID).

  4. Optional: Add any additional details around the activity, such as metadata, in the Activity information section.

The section Advanced Settings is not part of the XO tag configuration.

Example

A basic tracking configuration for events that relate to a single product should look like this:

XO Multi-Activity Tracking

Use this template to send multiple activity events for a single user action, such as when a user purchases multiple items in their basket:

  1. Add the template to your workspace.

  2. Use the New button in the Tag section, add a new tag.

  3. Select the XO Multi-Activities Tracking template.

  1. Set up your variable in the "Target list" section.

Your variable should be an array of objects like in the following example:

"buyedProducts": [
    {id: "product1", "price": 100, quantity: 1},
    {id: "product2", "price": 50, quantity: 2}
]
  1. To set product-specific values for an event, add rows to the Attributes section. Each row corresponds to a different value in your variable, and allows you to define what it will be mapped to in the activity object. In the following example, we will map the ID, price and quantity from our variable (the input object) to the target.product , metadata.price and metadata.quantity fields in the resulting activity object.

Each tracker key can only be used with a single currency.

  1. To set information that is specific to this group of events, and not each product (eg: orderId or currency) you can add them in the common section.

Add one or more targets. A target is a key-value pair which corresponds to the target property of the .

Optional: Add any additional information about the user, such as traits, or segments, in the User information section. These fields correspond to the different parts of the .

For the most part, you can use this template in the same way as the . The key difference in the requirement of a containing all the necessary product information.

activity object
user object
variable
XO Activities Tracking template
user activities
XO Activities Tracking
XO Multi-Activities Tracking
Community Template Gallery
information to be tracked