Setting up GTM to send Recos Datalayer Events

🎯
The goal is to configure GTM so it will send Analytics events based on the Recos Events pushed in the DataLayer. If we have Publisher access to GTM, usually the TSM does this setup for the client directly.
1/ Create trigger
2/ Create 6 variables 3/ Create tag 4/ Publish

1/ Create the trigger

Go to Trigger
Image without caption
Trigger > New
Image without caption
Create a new trigger:
Image without caption
Title = Recos - trigger
Trigger type : Custom Event
Event name = ab_recos Select: use regex matching All custom events SAVE
Image without caption
⚠️
Tick “Use regex matching”

3/ Create the 6 variables

Go to Variables >
Image without caption
Scroll down to reach “User-defined variables” > New
Image without caption
Create all the following variables with the following data layer variable name :
Fill the title (ex: action_id) and the datalayer variable name (ex: recos.action.id)
Variable type = Data Layer variable
Image without caption
  • action_id → recos.action_id
  • reco_id → recos.reco_id
  • reco_name → recos.reco_name
  • item_id → recos.item_id
  • item_ids → recos.item_ids
  • debug_mode → recos.debug_mode
    • Image without caption

4/ Create the Tag

Image without caption
Image without caption
Name: Recos - Event GA4 - recos
Tag configuration > Google Analytics > GA4 event
Image without caption
GA4 Event:
Image without caption
Fill the measurement ID: to be found in the GA4 of the client
Image without caption
—> Go to the GA4 of the client GA4 > Admin >
Image without caption
Data Stream:
Image without caption
Copy the Measurement ID:
Image without caption
Paste the measurement ID in GTM:
and event Name = ABTastyRecos
Image without caption
Create and add all the following event parameters with the previously created variables :
Click Event Parameters > Add parameter
Image without caption
ex: action_id
Click on Value +
Image without caption
Find the variable created previously:
Image without caption
Image without caption
Do it for all 6 event parameters and values, as created previously:
  • action_id
  • reco_id
  • reco_name
  • item_id
  • item_ids
  • debug_mode
Where each variable is defined this way
Select the trigger:
Image without caption
Select the trigger Recos - trigger created before
Image without caption
Image without caption
Image without caption

5/ Publish

SAVE
Workspace changes are 8: 6 new variables, 1 new trigger, 1 tag.
Give a name (ex: ABTasty reco tracking event)
Image without caption

Powered by Notaku