• Home  / 

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: 

  1. Enabling Google Analytics 
  2.  Implementing a Data Layer
  3. Configuring Google Tag Manager

 

I. Enabling Google Analytics E-commerce Tracking

  1. Open Google Analytics and navigate to the Admin section.
  2. Navigate the View Section
  3.  Click E-commerce Settings
  4. Under Enable E-commerce, switch to ON

ecommerce setting is turn on in analytics

Ecommerce tracking can be enabled by using the Admin section in Google Analytics

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

  1. Open Google Tag Manager
  2.  Select Trigger
  3. Create a New Trigger
  4. Choose Page View and choose Some Pages
  5.  Select Page URL equals to /thankyou  (You need to put the exact thankyou page 
  6.  Name the trigger
  7.  Select a Tag and choose New
  8.  In the Tag Configuration Window, Choose Google Analytics Tag 
  9. Configure the Tag by adding your Google Analytics ID and choose Transaction for Track Type
  10. Now choose a your new trigger

Here is how the Trigger Configuration should look

The trigger should be set for just the thankyou page for ecommerce