AFL UTM Tracker Documentation

  1. Home
  2. Docs
  3. AFL UTM Tracker Documentation
  4. Cookie Consent Banner Integration
  5. Google Tag Manager Integration

Google Tag Manager Integration

Since AFL UTM Tracker version 2.14.7, we have prepared two Javascript functions where you can use them in your Google Tag Manager (GTM) Custom HTML Tag or Template.

If your cookie consent banner plugin already has an integration with Google Consent Mode, you can proceed to our Google Consent Mode documentation.

Please reach out to us by email if you need help with a specific Cookie Consent Banner.

Minimum Requirements:

  • AFL UTM Tracker v2.14.7

Plugin Setting

  1. Login to your WordPress dashboard.
  2. Go to AFL UTM Tracker > Settings.
  3. Look for the Cookie Consent Integration section.
  4. Set Cookie Consent Integration: GTM / Manual
  5. Set Consent Category: Statistics or Marketing
  6. Save settings.
  7. Clear all page cache.

NOTE: Setting the Consent Category does not affect anything since you will be using manually calling the javascript function to opt-in or opt-out of cookies.

Javascript Functions

The following Javascript file be loaded on the frontend. It is best to wait till the script has loaded before using the functions below.


The functions below can be used in your cookie consent banner plugins. There are usually callback function for opt-in and opt-out where you can insert the functions below.

Please check the documentation of your cookie consent banner plugin.





Google Tag Manager Template

If you plan to use our Javascript functions in your Google Tag Manager template, then you need to require the callInWindow API from the GTM Custom Template API.

const callInWindow = require('callInWindow');