Google Tag Manager (GTM) Set-up

The Google Tag Manager (GTM) allows any combination of Tags, Rules and Macros to collect, control and store information about the customers and traffic on your site.

This article discusses what a GTM container is and how to configure it for use with Aurora.

Overview

To begin to prepare the GTM for use by Aurora, you must set-up the following elements under your own GTM account in a dedicated container for use by Aurora.

  • Rules
  • Macros

Once you have created your container you should grant all privileges on the container to the Aurora Commerce support account (i.e. [email protected]) to ensure that the staff at Aurora Commerce have access should they need to be involved during the development process.

🚧

Please note that this is only a precaution as it should be possible to configure the GTM without the aid of a Aurora Commerce developer.

Configuring the GTM Container

Once you have created the GTM container and granted access to Aurora Commerce in the above step, you can begin to configure a few of the things needed to support its various features.

We will start with Macros and Rules.

Macros

Macros represent a piece of information you wish to send from Aurora to the GTM. These must be configured in advance in order for the GTM to manage them.

Create a separate Macro for each of the items described below.

NameTypeDescription
ga tracking idData Layer VariableData Layer Variable Name: ga tracking id

Data Layer Version: 2
page typeData Layer VariableData Layer Variable Name: page type

Data Layer Version: 2
userData Layer VariableData Layer Variable Name: user

Data Layer Version: 2

Rules

Rules represent a set of conditions used to identify a page or event on your site. They are used by the GTM to decide when to include a tag on your website.

Using the rules described below you should be able to allow the GTM to identify all the major sections of your site (e.g. the basket, checkout, product details page, etc), but you can add additional rules if you wish to identify other areas.

NameInformation
Page View All Pages{{url}} matches RegEx .*
Page View Home Page{{page type}} equals home, {{event}} equals gtm.js
Page View Product Listing Page{{page type}} equals productlist, {{event}} equals gtm.js
Page View Product Details Page{{page type}} equals productdetails, {{event}} equals gtm.js
Page View Basket Page{{page type}} equals basket, {{event}} equals gtm.js
Page View All Checkout Pages{{event}} equals checkout, {{event}} equals gtm.js
Page View Checkout Order Complete{{url path}} equals order-complete, {{event}} equals gtm.js
Event Product Click{{event}} equals productClick
Event Basket Product Added{{event}} equals addToCart
Event Basket Product Removed{{event}} equals removeFromCart
Event Checkout Option Changed{{event}} equals checkoutOption
Event Promotion Click{{event}} equals promotionClick
Event Product Impression{{event}} equals productImpressions

❗️

Changing or removing any of the above rules will result in the tracking provided in the Aurora Demo example not working as described in this guide and Aurora Commerce provide no support for this code on an ongoing basis.

With this being so, please consider before editing them whether you could simply create your own separate Rule to ensure the Aurora rules remain available.

Related Example Aurora Demo Templates

_includes/tracking/google-tag-manager/