FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

PresideCMS Extension: Google Tag Manager

v1.1.17+0000050 Preside Extensions

Google Tag Manager for Preside

This extension is for installing configuration for adding Google Tag Manager (GTM) scripts to the HEAD and BODY sections of the required layout templates as per the instructions in GTM.


From a commandline at the root of your application:

box install preside-ext-google-tag-manager


Once installed, login to the Preside admin and head to System -> Settings -> Google Tag Manager and enter the snippets from the instructions section in Google Tag Manager Admin -> Container -> install Google Tag Manager .


The extension will take care of inserting the Google Tag manager "snippets" into your layout automatically for you, you won't need to do anything else. However, you can customize the layouts that are effected.

To customize the layouts, set the settings.googleTagManager.layouts variable in your Config.cfc:

settings.googleTagManager.layouts = [ "main", "newsletter" ]; // default is [ "main" ]

New helper methods

There are two new helper methods that can be used for pushing and exposing application data to the DataLayer

  • publishDataForAnalytics - used to push data into the DataLayer
  • getPublishedDataForAnalytics - used by the extension to construct the DataLayer output ** The outputting of the DataLayer JSON object is taken care of you automatically by the extension, if anything is set in the DataLayer using the publishDataForAnalytics method


If you're using the Google Analytics extension, please ensure this is removed or the configuration for the tracking ID is removed to help prevent double tags/events being fired.

Contributing and roadmap

Pull requests, issues and ideas are all welcome :) Please get in touch with the Preside team on our Preside Slack.



  • Bug Fix: Updating the form definition input type attribute to be control and not type


  • Adding dataLayer output even if the scripts are not loaded via this extension and possibly via another method built into the site ** This could be within the project code directly or via another extension e.g. Civic Cookie Control

v1.1.14 & v1.1.15

  • Refactoring to ensure the dataLayer is always in front of the GTM script + updating the CHANEGLOG file


  • Bug Fix: Wrong view path set for the dataLayer data template


  • Updating the interceptor to retrieve and output the DataLayer data, if any exists


  • Add helper functions publishDataForAnalytics() and getPublishedDataForAnalytics()


  • Output head tags directly after element


  • Remove asset building from build script


  • Migrate build to GitHub Actions


  • Increasing the text limit on both form fields to allow for bigger scripts


  • Allow for the possibility of one or more comment tags inside the opening <body> tag


  • Removing local asset preprocessing, not required


  • Completing move to GitHub, including ensuring the build script is executable and the ChangeLog is recognised by ForgeBox


  • Relocating repo to Pixl8 GitHub account


  • Publishing to Forgebox, opensource


  • Bug fix - missing commas


  • Original build - completed


  • Original build

$ box install preside-ext-google-tag-manager

  • {{ getFullDate("2019-09-25T04:33:25Z") }}
  • {{ getFullDate("2023-03-28T15:08:34Z") }}
  • 2,584
  • 54,880