GTM ConditionalFiring
From Wiki
Contents |
[-] Google Tag Manager Conditional firing
Defining triggers
Triggers need to be defined in Google Tag Manager to control the conditions in which you allow your 'Tags' to be displayed on the page via Google's container tag solution.
Part 1: Define trigger 1 (AwCookieTrigger)
You will need to define a trigger based on an on site variable or 1st party cookie that stores whether the visit was from an Awin referred click.
1) Click the “new” button
2) Select ‘Custom event’
3) Select ‘Add Filter’ button, below the event name input.
4) Select the fire on rules e.g. when 1st party cookie equals your on site value stored for Affiliate window referred clicks. In this example we store 'aw' in the 1st party cookie when the last click is referred from Awin.
5) Click 'save trigger'
6) Rename this trigger to AwCookieTrigger
7) Click ‘save’ to have the variables and triggers in place
Part 2: Define trigger 2 (awinFire)
This will conditionally fire the Awin sale tracking only when the data layer variable SourceParam equals 'aw' AND the page url equals that of the confirmation page. For instructions on how to set a data layer variable like this please see here
1) Click the “new” button
2) Select ‘Page View’
3) Select 'Some page views'
4) Notice how 'sourceParam' was a variable defined earlier. Choose this variable 'sourceParam' to ‘contains’ the value 'aw' for the tag to fire.
Part 3: Define the Awin Master tag tracking
Tags reference 3rd party tracking or code snippets you may want to place on site via the Google Tag Manager container.
1) Click “Tag”
2) Click “new” and choose the 'Awin Journey' tag (this is the masterTag that needs to be present on all pages incl. confirmation page).
3) Enter your numeric advertiser ID provided by your Integrator, click continue
4) Select your aw cookie trigger as the master tag is required to be across site but only when there is a 1st party cookie 'aw'
5) We then need to add in an Exception to this trigger. Define that this trigger will fire on every page view but block this behaviour on the confirmation page as the master tag is already within the conversion tag so(add the 'AwinTrigger') as the exception.
6) Save this tag appropriately
Part 4: Define the Awin sale tracking
1) Create a new ‘affiliate window’ Tag and select the ‘Awin Conversion’ type.
2) Define your data layer values
3) Click ‘continue’
4) Select a trigger defined in part 1-2. Select the trigger defined in part 1 'AwCookieTrigger'.
5) Click ‘create Tag’ and you will then be asked to rename the Tag but you can leave it as it is.
6) Click ‘save’ and you should now have two Tags listed in the Tags table.