Set up Google Tag Manager for your website

  • Updated

Universal Analytics (GA3) will be sunsetted in July 2023. New clients should implement Google Analytics 4 (GA4), rather than Universal Analytics.

Implementation of Universal Analytics (GA3) requires a testing process. Optimizely recommends that you implement Universal Analytics on your Sandbox site first and verify accurate tracking of user events before recreating the tracking on your Production site. The following steps will need to be completed twice: once for Sandbox and once for Production.

Create a new container

  1. Go to the Google Tag Manager home page. Once logged in, you will see name of your Google Analytics account, followed by a list of Containers. The list may be empty.
  2. Click the More Options icon and select Create Container.
  3. Enter a name in the Container name. Optimizely recommends including your site name, the purpose of the container, and the environment. For example, “MySite – OptiTemplate – Sandbox.”
  4. Select Web under Target platform.
  5. Click Create.
  6. Click OK on the pop-up that appear with the code snippets to be installed on your site. These snippets should be shared with your partner for implementation on your site.
    • The snippet can be retrieved later by logging into Tag Manager using the link above.
    • Find the blue number that starts with GTM- followed by 7 characters. This is your Container ID.
    • Click on the Container ID to see the snippets for your Tag Manager Container.

Import template container

  1. Click on Import Container under the container that you just created. Use the appropriate template container file at the bottom of this article for Classic or Spire CMS. This file is named similarly to Template-defaultWorkspace.json.
  2. Go to Select file to import, select the json file on your computer, and upload it to Tag Manager.
  3. Select Existing for the workspace. In the pop-up screen, select the Default Workspace, then close it.
  4. Select Merge for the Import Option. Check the box for Overwrite conflicting tags, triggers, and variables.
  5. Click Confirm.

Verify or edit variable ID

  1. Return to the Tag Manager home page, and click Variables under Workspace.
  2. Click on the variable entitled GA ID under the User-Defined Variables section. You will see a pop-up screen with the Variable Configuration.
  3. Review the Tracking ID provided. This should match the ID of your Google Analytics account. If it does not, you can edit the Tracking ID by clicking Edit.

Implement the Google Analytics Snippet on your site

You need to add the Universal Analytics snippet to your site so that Google Analytics can start collecting data. Because the Tag Manager snippet supports both Google Analytics and Tag Manager, you only need to install one snippet.

  1. Go to the Google Tag Manager home page.
  2. Find the container you just created and copy the Container ID. The Container ID starts with GTM- followed by 7 characters.
  3. Open the Admin Console of your Configured Commerce instance.
  4. Go to Administration System Settings.
  5. Select the Sandbox or Production site you will be tracking in the Configuring dropdown.
  6. Go to System Settings > Analytics
  7. Select Google Tag Manager for Google Tracking Type.
  8. Enter the URL for the Sandbox or Production site for Google Tracker Domains.
  9. Enter the Container ID for Google Tracking Account ID.
  10. Click Save

You have now completed a basic set-up for Tag Manager. Once you have verified Tag Manager data in Sandbox, you need to repeat the steps for Production. The set-up for production will be identical to Sandbox but will have separate containers and properties.

If you would like to learn more about Google’s Tag Manager, you can watch the Google Tag Manager Fundamentals video at Google Analytics Academy.

Default tags included in Optimizely’s template tag container

This article describes a basic setup for Tag Manager and has a template container with a set of tags that will help you get your Tag Manager site up and running. This section explains the details of the tags included in that container and refers to the json file entitled Template-defaultWorkspace.json.

The Tags provided in the template container are designed to work for B2B Analytics. Changes to the CSS may affect the behavior of these tags and should be tested and/or reviewed by your implementation partner or someone knowledgeable about Google Analytics before being pushed to production.

Below is the list of self-service tags that are in the template provided by Optimizely and are organized by group for easier identification.

  • Tags related to PageView Navigation: These tags are maintained in the variables setup called Digital Self Service Pageview Lookup and under the name GA – Event – Self-Service.
    • myaccount
    • catalog
    • contactus
    • orders
    • requestaccount
    • dealerlocator
  • Tags related to Lists
    • create list (GA – Event – createList)
    • add to list (GA – Event – addToList)
    • share list (GA – Event – shareList)
    • update list (GA – Event – updateList)
  • Tags related to Orders
    • quickorder (GA – Event – QuickOrder)
    • reorder button (GA – Event – reorderButton)
    • upload order (GA – Event – UploadOrder)
  • Tags related to Downloading Content
    • download content (pdf, jpg, xlsx, doc) (GA – Event – FileDownload)

Json files