E-Commerce Tracking with Google Tag Manager
Tracking conversions from your website’s store or payment gateway is extremely important to not only record your sales but to also identify where your transactions are coming from. To bring this data into Google Analytics, e-commerce tracking needs to be enable and setup.
Implementing E-commerce Tracking with Google Tag Manager will take a few steps:
- Enabling Google Analytics
- Implementing a Data Layer
- Configuring Google Tag Manager
I. Enabling Google Analytics E-commerce Tracking
- Open Google Analytics and navigate to the Admin section.
- Navigate the View Section
- Click E-commerce Settings
- Under Enable E-commerce, switch to ON
II. Implement the E-commerce Data Layer
Implementing the e-commerce data layer will be highly dependent on your website structure and payment shop. For example, if you are using Magento, you will need to pay for a plug in that places the data layer in the code. Depending on what variables you want to bring into Google Analytics, the code may need modification. If you are not familiar with Javascript and setting up a data layer, it’s probably best that you have a developer set this up for. Here is a sample of a e-commerce data layer.
<script> window.dataLayer = window.dataLayer || [] dataLayer.push({ 'transactionId': '1234', 'transactionAffiliation': 'Acme Clothing', 'transactionTotal': 38.26, 'transactionTax': 1.29, 'transactionShipping': 5, 'transactionProducts': [{ 'sku': 'DD44', 'name': 'T-Shirt', 'category': 'Apparel', 'price': 11.99, 'quantity': 1 },{ 'sku': 'AA1243544', 'name': 'Socks', 'category': 'Apparel', 'price': 9.99, 'quantity': 2 }] }); </script>
III. Setting the E-commerce Tag in Google Tag Manager
- Open Google Tag Manager
- Select Trigger
- Create a New Trigger
- Choose Page View and choose Some Pages
- Select Page URL equals to /thankyou (You need to put the exact thankyou page
- Name the trigger
- Select a Tag and choose New
- In the Tag Configuration Window, Choose Google Analytics Tag
- Configure the Tag by adding your Google Analytics ID and choose Transaction for Track Type
- Now choose a your new trigger
Here is how the Trigger Configuration should look