Google Tag Manager

About GTM (Google Tag Manager), how to set up and install it, and how to use it to add third-party scripts and functionality to your site

Matthew Schwartz avatar
Written by Matthew Schwartz
Updated over a week ago

What is GTM (Google Tag Manager) ?

Google Tag Manager lets you configure and deploy tags (see below) from Google products and third parties. This gives you the ability to add scripts and new functionality to your website without needing to edit the site code directly.

Not only does this give you more control over your site, but it's convenient because in general we cannot add custom code or modify your site theme on CrystalCommerce, since we use global template files (which can't be edited) for the sections where scripts usually need to be inserted. Thus, you can add scripts and functionality to your site with GTM which you otherwise could not.

What is a tag? (in reference to GTM)

Basically, a tag is a piece of code, like a script or embed, which adds functionality to your website.

NOTE: Tags are not the same thing as the "tags" which the CrystalCommerce admin uses for tagging banners, products, and so on. Those are a separate feature and don't relate to GTM at all.

How does this all work? (Overview)

A very basic explanation of how GTM works with CrystalCommerce is that you create a GTM account and the necessary settings within it, set up the integration of your GTM with your CrystalCommerce site, add the code you want to run into your GTM account, and then the code you put in GTM will work on your CrystalCommerce site.

The high-level steps are:

  1. Create a GTM account

  2. Link the GTM account ID into your CrystalCommerce admin integration

  3. In GTM, create a "container" which will hold the tags

  4. In GTM, create tags inside the container which hold the code / scripts

  5. Test the GTM tags, and then publish them so they become live on your site

GTM setup and installation steps:

  • See the "References" section at the bottom of this page for a link to the Google documentation for GTM, which will walk you through setting up your account, containers, and tags.

CrystalCommerce integration steps:

  1. First, follow the Google documentation to set up your GTM account, one container, and all the tags you want. Copy or take note of the container ID.

  2. Sign in to your CrystalCommerce admin, then navigate to Account > Integrations > Google Analytics

  3. Enter the GTM container ID in the "Google Tag Manager Container ID" field

  4. Click the "Save Google Analytics Settings" button

Caveats and Important Notes

  • Not all CrystalCommerce sites / themes have the GTM integration functionality. The sites which will not work with GTM are primarily very old websites. Most of the sites created from 2017 onward are compatible.

  • You cannot choose where in the site code the container and tags will be output. The GTM container and tags will be output in the <head> section of your site, and that cannot be changed. The <head> is an invisible section of your site's code where scripts and metadata elements are output.

  • We only support ONE container. You can install ONE GTM container ID into your CrystalCommerce site. All tags you want to run on your CC site must be inside that one container.

  • We cannot guarantee that all tags, scripts and other code you might insert with GTM will be compatible with the CrystalCommerce website. You should thoroughly test your site after publishing tags to your site, to ensure nothing broke and that your tags are functioning as intended.

  • We do not offer support for setting up and using GTM. We only offer the integration within the admin, but all other things regarding setting up and using GTM are up to you. If you need help, we suggest referencing the GTM documentation and help info through Google, and contacting Google support if needed.

References

Set up and install Tag Manager (Google help article)

Did this answer your question?