Install Google Tag Manager

  • Updated

Optimizely Configured Commerce business users have the option to install either basic Google Analytics or a Google Tag Manager container on their various websites and domains by using three simple Website Settings. The steps to install Google Tag Manager are below.

Note: You need the ISC_Implementer role to make these changes.

Locate the Google Tag Manager Container ID

Using the out-of-the-box Google Tag Manager implementation will allow you to provide the unique Google Tag Manager Container ID (often referred to as a "GTM ID") and the domains in which you want that tracker installed, and Configured Commerce will place the Google Tag Manager snippet with your provided GTM ID in the correct location across all pages on your site, as well as install the data layer for future use. If you are having trouble locating your container ID, see the Google Support article.

Update the Google Tracking Settings

There are three settings responsible for the configuration of Google Analytics. For Spire sites, be sure to add the domain name (non-url) to the GTM settings.

Name Value

Google Tracked Domains

A list of domain names for which Google Tracking is enabled. While this could be for any account, it is normally set for Configured Commerce Analytics purposes. Be sure to include the fully qualified domain, which is anything between the https:// and the next /. For example, www.mydomain.com.

Google Tracking Account ID

Either the UA ID of the Google Analytics tracker you'd like to install, or the GTM ID of the Google Tag Manager Container you'd like to install

Google Tracking Type

'GoogleAnalytics',  'GoogleTagManager' or 'Google Analytics 4' depending on which tracker you have decided on using (see Google_TrackingId above)

    1. To update these settings, go to the Admin Console > Administration > System > Settings.
    2. In the Search Box, enter "google track". The three settings will display.

    3. Notice that the System Settings finger tab is highlighted, showing that the three settings are located within this section.

    4. Click the System Settings finger tab.
    5. Under the Analytics section, set the following options:
      • Google Tracking Type: select Google Tag Manager
      • Google Tracked Domains: enter the website URL as defined on the websites page for that specific site
      • Spire clients need to set up 2 entries for tracked domains: (use the Add More button to add additional domains)
        • the customer facing URL (not the integration URL!)
        • the commerce-“website name” (example below – commerce-herotools)
        • Google Tracking Account ID: the GTM tracking ID from Google Tag Manager

        blobid0.png

    6. Save your changes.

      Example for using Google Tag Manager tracking type:

      blobid1.png

Enable applicable settings in Google Analytics

In order to capture the eCommerce data, as well as the Custom Dimensions, you'll need to enable both in the settings of Google Analytics.

Enabling eCommerce in Google Analytics

Log into the applicable Google Analytics view you are using, and navigate to the Admin panel. Under the Ecommerce Settings turn on the Status slider under Enable Ecommerce. You may leave the remaining options off. You will need to repeat this step for all views you wish to capture eCommerce data.

Enabling Custom Dimensions in Google Analytics

In order to capture and use Custom Dimensions in Google Analytics reporting, you must first enable them on the Google Analytics Property settings. To do so, navigate to the Custom Definitions > Custom Dimensions section of the Property Settings in Google Analytics.

Add Custom Dimensions with the scope as listed below.

Note: The Index number of both of your Custom Dimensions, and ensure they align with how they are configured on your Google Analytics tag inside Google Tag Manager.

mceclip0.png

Optional: Site Search Tracking

Optionally, you may also choose to enable Site Search Tracking in Google Analytics. Site Search Tracking allows you to understand visitor engagement metrics regarding the search box on your site. Metrics such as percentage of sessions with search, all keywords that have been searched and more are captured with this setting enabled.

To enable this, navigate to the View Settings in the Google Analytics View you are using on your Epi Configured Commerce website. Scroll to the bottom of the page, use the slider to turn on the Site search Tracking option, and enter criteria as the Query parameter. Be sure to Save your changes. You will need to repeat this process for all Views you wish to capture Site Search data for.

mceclip1.png

Example of the Google Analytics Site Search Tracking Reports:

Configure Tags, Triggers and Variables in Google Tag Manager

The following will explain the tags, triggers and variables Configured Commerce uses and how you can configure it in Google Tag Manager.

Variable - Authentication State

mceclip2.png

Variable - User ID

mceclip3.png

Variable - Session ID

mceclip4.png

Variable - GA ID

Note: Replace the Tracking ID with your own Google Analytics UA ID in the Google Analytics Admin page.

mceclip5.png

Trigger - virtualPageview

mceclip6.png

Trigger - eCommerce Transaction Event

mceclip7.png

Tag - Universal Analytics Pageview

Note: Replace the GoogleAnalytics Settings in the GA ID variable as listed below.

mceclip8.png

Tag - Google Analytics eCommerce

Note: Replace the GoogleAnalytics Settings in the GA ID variable as listed below.

mceclip9.png