How to install Google Analytics and set up enhanced e-commerce with Google Tag Manager
How to install Google Analytics and set up enhanced e-commerce with Google Tag Manager
Go to the video
Video version
{% endembed %}
Install Google Analytics with Google Tag Manager
This step requires you to remove the Google Analytics tracking code (UA-XXXX) from your control panel.
Create an account and a Google Tag Manager container
If you do not already have a Google Tag Manager account, the first step is to create an account at the following address: https://tagmanager.google.com/. You must have a Google account to connect to the platform.
1 - In Google Tag Manager, click Create an account.
2 - In account setup, enter your company name as account name, choose your country and specify if you want to share data anonymously with Google and third parties.
3 - In container setup, enter a descriptive container name and select the Web content type. Finally, click create.
4 - Review the terms of use and click Yes if you agree to them.
When you first load your new container, you will be prompted to install the web container code snippet.
To install Google Tag Manager on your site, simply copy the container ID (GTM-XXXX) in the dedicated field of your administration panel:
Configure the installation of Google Analytics in Google Tag Manager
1- From any page of your container, click on Tags > New.
2 - The tag configuration page will appear. Click on Tag Setup and select Google Analytics: Universal Analytics.
3 - Select the tracking type "**Page view**".
4 - In Google Analytics Settings, select new variable.
5 - The variable configuration page is displayed. Name your variable (here, "**Google Analytics ID**").
6 - Enter your Google Analytics ID in the Tracking ID field.
7 - Click on More Settings > Field to define then add > + Add a field
8 - In Field name fill in exactly "page " then in value click on the lego icon to create a new variable.
9 - Once the Select a variable window is open, click on the + icon at the top right.
10 - Name your variable DL\_page\_path
11 - In the field Name of the data layer variable, enter exactly "**page\_path "**.
12 - Click on Save.
13 - Click on Register a second time to create your variable.
14 - Click on Trigger to choose the trigger that will activate the
15 - Once the Choose a trigger window is open, click on the + icon on the top right.
16 - Name your trigger GA\_page\_view, click on trigger configuration and select the trigger type Customized event.
17 - Once the trigger is selected, enter exactly the following value in the Event name field: GA\_page_view. Click on Save.
18 - Click on the + icon at the top right of the Trigger window** to add a second trigger.
19- Click on the + icon at the top right of your window to create a new trigger. !
20 - Name your trigger virtual page view, click on trigger configuration and select the trigger type custom event.
21 - Once the trigger is selected, enter the following value in the Event name field: virtual\_page\_view. Click on Save.
22 - Your Google Analytics tag is finalized, click on Save.
23 - From the workspace, click Send then Publish.
Configure event measurement
Creating the actionValue variable
1 - Click on Variable then in the User Defined Variable window, click on New.
2 - Name your variable actionValue.
3 - Click on Variable configuration and click on Data layer variable.
4 - In the Data Layer Variable Name field, enter exactly : value.
5 - Click on Save
Creation of the GA event - action tag
1 - Click on Tags then New.
2 - Name your tag GA event - action.
2 - Click on Configuration of the tag then Google Analytics : Universal Analytics.
3 - Set the tracking type to Event.
4 - Configure the Event Tracking Settings section as below:
Category: Action
Action: {{ actionValue }}
For the action, fill in exactly the value above (including brackets) or click on the lego icon and select the actionValue variable
5 - In Google Analytics Settings : select your existing "Google Analytics ID " variable.
6 - Click on Trigger and click on the + icon at the top right of your window to create a new trigger.
8 - Assign the name layer\_action to your trigger. Click on Trigger Configuration and select the Custom Event trigger type.
9 - In Event name, fill in exactly layer_action..
10 - Click on Save to save your trigger
11- Your tag is finalized, click on Save
12 - Click on Send and Publish the container.
Configure the e-commerce measure
Enable enhanced e-commerce measurement in Google Analytics
1 - In Google Analytics, go to the Administration section of Google Analytics
2 - In your column View click on E-Commerce Parameter.
3 - Activate the e-commerce and the reports on the improved e-commerce
Add to cart
1 - Click on Tags then New.
2- Name your tag GA event - Add to Cart.
2 - Click on Configuration of the tag then Google Analytics : Universal Analytics.
3 - Set Tracking Type to Event.
4 - Configure the Event Tracking Settings section as below:
Category: ecommerce
Action: Add to Cart
5 - In Google Analytics Settings: select your existing "Google Analytics ID " variable and check Allow replacement of parameters in this tag.
6 - In More settings, select E-commerce. In Enable enhanced e-commerce features select True then check Use data layer.
7 - Click on Trigger and click on the + icon at the top right of your window to create a new trigger.
8 - Assign the name addToCart to your trigger. Click on Trigger Configuration and select the Custom Event trigger type
9 - In Event Name, fill in exactly addToCart.
10 - Click on Save to save your trigger
11- Your tag is finalized, click on Save
12 - Click on Send and Publish the container
Deleting the basket
1 - Click on Tags then New.
2- Name your tag GA event - Remove from Cart.
2 - Click on Configuration of the tag then Google Analytics : Universal Analytics.
3 - Set the Tracking Type to Event.
4 - Configure the Event Tracking Settings section as below:
Category: ecommerce
Action: Remove from Cart
5 - In Google Analytics Settings: Select your existing "Google Analytics ID " variable and check Allow replacement of parameters in this tag.
6 - In More settings, select E-commerce. In Enable enhanced e-commerce features select True then check Use data layer.
.png>)
7 - Click on Trigger and click on the + icon at the top right of your window to create a new trigger.
8 - Assign the name removeFromCart to your trigger. Click on Trigger Configuration and select the Custom Event trigger type.
9 - In Event Name, fill in exactly removeFromCart..
10 - Click on Save to save your trigger
11- Your tag is finalized, click on Save
12 - Click on Send and Publish the container.
Purchase
1 - Click on Tags then New.
2- Name your tag GA event - Purchase.
2 - Click on Configuration of the tag then Google Analytics : Universal Analytics.
3 - Set the tracking type to Event.
4 - Configure the Event Tracking Settings section as below:
Category: ecommerce
Action: purchase
5 - In Google Analytics Settings : select your existing "Google Analytics ID " variable and check Allow replacement of parameters in this tag.
6 - In More settings, select E-commerce. In Enable enhanced e-commerce features select True then check Use data layer.
.png>)
7 - Click on Trigger and click on the + icon at the top right of your window to create a new trigger.
8 - Assign the name order.confirmation to your trigger. Click on Trigger Configuration and select the Custom Event trigger type
9 - In Event name, fill in exactly order.confirmation..
10 - Click on Save to save your trigger
11- Your tag is finalized, click on Save
12 - Click on Send and Publish the container.
Purchasing steps
Creation of the checkoutStep variable
1 - Click on Variable then in the User Defined Variable window, click on New.
.png>)
2 - Name your variable checkoutStep
3 - Click on Variable Configuration and click on Data Layer Variable
4 - In the Data Layer Variable Name field enter exactly : ecommerce.checkout.actionField.action
5 - Click on Save
Creation of the GA event tag - Checkout
1 - Click on Tags then New.
2 - Name your tag GA event - Checkout Option.
2 - Click on Configuration of the tag then Google Analytics : Universal Analytics.
3 - Set the Tracking Type to Event.
4 - Configure the Event Tracking Settings section as below:
Category: ecommerce
Action: Checkout
Label : {{ checkoutStep }}
For the label, fill in exactly the value above (including hooks) or click on the lego icon and select the variable c**heckoutStep**
5 - In Google Analytics Settings : Select your existing "Google Analytics ID " variable and check Allow replacement of parameters in this tag.
6 - In More settings, select E-commerce. In Enable enhanced e-commerce features select True then check Use data layer.
.png>)
7 - Click on Trigger and click on the + icon at the top right of your window to create a new trigger.
8 - Assign the name checkout to your trigger. Click on Trigger Configuration and select the Custom Event trigger type.
9 - In Event Name, fill in exactly checkout..
10 - Click on Save to save your trigger
11- Your tag is finalized, click on Save
12 - Click on Send and Publish the container.
Creation of the purchase tunnel in Google Analytics
1 - To configure the name of the stages of the purchase path in Google Analytics, go to the Administration part of Google Analytics
.png>)
2 - In your View column click on E-Commerce Parameter
.png>)
3 - Click on Add a step to the conversion funnel and configure the steps as below:
Updated on: 24/01/2023
Thank you!