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
Trigger > New
Create a new trigger:
Title = Recos - trigger
Trigger type : Custom Event
Event name = ab_recos
Select: use regex matching
All custom events
SAVE
Tick “Use regex matching”
3/ Create the 6 variables
Go to Variables >
Scroll down to reach “User-defined variables” > New
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
- 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
4/ Create the Tag
Name: Recos - Event GA4 - recos
Tag configuration > Google Analytics > GA4 event
GA4 Event:
Fill the measurement ID: to be found in the GA4 of the client
—> Go to the GA4 of the client GA4 > Admin >
Data Stream:
Copy the Measurement ID:
Paste the measurement ID in GTM:
and event Name = ABTastyRecos
Create and add all the following event parameters with the previously created variables :
Click Event Parameters > Add parameter
ex: action_id
Click on Value +
Find the variable created previously:
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:
Select the trigger Recos - trigger created before
5/ Publish
SAVE
Workspace changes are 8: 6 new variables, 1 new trigger, 1 tag.
Give a name (ex: ABTasty reco tracking event)