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
- Login to your WordPress admin dashboard.
- Go to AFL UTM Tracker > Settings.
- Under the Attribution section, enable the “Google Tag Manager Data Layer”.
- Save settings.
- Clear all page cache from your caching plugin.
Google Tag Manager (GTM)
The next step is to verify that our plugin sends an event to GTM.
- Login to your Google Tag Manager dashboard.
- Go to your website’s container.
- 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
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.
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.
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