AFL UTM Tracker Documentation

  1. Home
  2. Docs
  3. AFL UTM Tracker Documentation
  4. Google Tag Manager
  5. Setup GTM Data Layer

Setup GTM Data Layer

You can send UTM parameters from your WordPress site to your Google Tag Manager (GTM) using our AFL UTM Tracker plugin.

Minimum Requirement

  • AFL UTM Tracker v2.17.1

Steps

AFL UTM Tracker > Settings

  1. Login to your WordPress admin dashboard.
  2. Go to AFL UTM Tracker > Settings.
  3. Under the Attribution section, enable the “Google Tag Manager Data Layer”.
  4. Save settings.
  5. Clear all page cache from your caching plugin.
AFL UTM Tracker > Settings > Enable "Google Tag Manager Data Layer"
AFL UTM Tracker > Settings > Enable “Google Tag Manager Data Layer”

Google Tag Manager (GTM)

The next step is to verify that our plugin sends an event to GTM.

  1. Login to your Google Tag Manager dashboard.
  2. Go to your website’s container.
  3. Click on the Preview button to launch the debugger.

Depending if you are using a cookie consent banner solution or not, one of these event names will be sent to GTM along with the parameter afl_wc_utm which contains the attribution data.

  • afl_wc_utm.optin
  • afl_wc_utm.optout
Google Tag Manager > Preview > Events
Google Tag Manager > Preview > Events

GTM Variable

Before you can access the UTM parameter in your tags or triggers, you will need to create variables.

  • Go to the Variables menu.
  • User-Defined Variables > New.

First Touch UTM Source

  • Label: AFL – UTM Source – First Touch
  • Variable Type: Data Layer
  • Data Layer Variable Name: afl_wc_utm.utm_first_touch.utm_source
  • Check the “Set Default Value” checkbox. Leave the Default Value as blank.
Variable > First Touch UTM Source
Variable > First Touch UTM Source

Last Touch UTM Source

  • Label: AFL – UTM Source – Last Touch
  • Variable Type: Data Layer
  • Data Layer Variable Name: afl_wc_utm.utm_last_touch.utm_source
  • Check the “Set Default Value” checkbox. Leave the Default Value as blank.
Variable > Last Touch UTM Source
Variable > Last Touch UTM Source

List of Variable Name

Repeat the steps above for other UTM parameters or click identifiers. You can access other properties in the event parameter by using the array dot notation.

afl_wc_utm.utm_first_touch.utm_source
afl_wc_utm.utm_first_touch.utm_medium
afl_wc_utm.utm_first_touch.utm_campaign
afl_wc_utm.utm_first_touch.utm_term
afl_wc_utm.utm_first_touch.utm_content

afl_wc_utm.utm_last_touch.utm_source
afl_wc_utm.utm_last_touch.utm_medium
afl_wc_utm.utm_last_touch.utm_campaign
afl_wc_utm.utm_last_touch.utm_term
afl_wc_utm.utm_last_touch.utm_content

afl_wc_utm.gclid.clid
afl_wc_utm.msclkid.clid
afl_wc_utm.fbclid.clid