How to enable ecommerce tracking in Google Tag Manager

Last updated on
11 March 2021

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

This documentation needs work. See "Help improve this page" in the sidebar.

Have you got your Google Tag Manager (GTM) account already registered, installed Google Tag Manager and Commerce Google Tag Manager modules and set up your universal tracking for Google Analytics, but not seeing any ecommerce transactions in your GA account?

Then one more vital step is required to complete in GTM before any e-commerce transactions will be shown in your analytics: you need to add an extra tag to your container which is fired for a special event only. Follow the steps below:

  1. Log in to the Google Account and navigate to the administration interface of GTM. Open up the container which you use for the given website and go to the 'Tags' option on the left side menu. Although sending only transactional data to GA works even without measuring site traffic, however as most users implement both of them, now we assume also that you already have your tag set up for tracking page views:
    GTM admin interface
     
  2. Open the editing page of this GA-tag and seek for the hamburger menu around the top right corner. Select the 'Copy' option from this menu:A GA-tag already existing

    Doing this cloning way makes sure that your GA Tracking ID (the UA-12345678 identifier) is kept the same. (In the rare case if you want to measure transactional data into a different account than page views, then, of course, don't forget to modify here.)
     

  3. Choose an arbitrary name (eg. 'DC Transaction Data') for this new tag by overwriting the default 'Copy of ...' text. Optionally, if you have many other tags and like keep things in order, you may consider organizing this tag into a folder. Naming a new folder as 'Drupal-specific tags' seems a good idea for example.Changing tracking type
  4. Now comes the first major part of configuration: this tag is meant to track not Page Views (as the original one), but Transactions instead. Switch the 'Track Type' dropdown regarding this. We also make modifications in the lower white area too. Here first we remove the 'All Pages' (or any other you have) triggers by the gray minus sign, then add a new Triggering method with the blue plus sign.Changing triggers
  5. Now we can not copy any previous triggers as we did with tags, so it's easier to create a new one instead. You can name the new trigger also as you wish, eg. 'Trigger for DC Transaction Data' and place it into the 'Drupal-specific tags' folder we created above. Click on the text Choose a trigger type to begin setup... and select 'Custom Event' from the list:Selecting Custom Event tag type
  6. For 'Event Name' type a dot (.) and an asterisk (*) and make sure that you don't forget to mark the 'Use regex matching' checkbox on. Between the options under 'This trigger fires on' title select the latter one saying 'Some custom events'. Now three more fields became available. In the first dropdown select 'Event', leave the second one on 'contains' and type into the third input 'trackTrans'. Finally, your trigger configuration should look like this:Final trigger configuration
  7. After saving the trigger we are returned to the tag configuration, where clicking the blue Save button in top-right corner again creates our event tracking tag.The new tag on the list
  8. Finally, don't forget to publish this new version of your container! All the new changes come into life only once the container is re-published again. You can name this new version as you wish and add a brief description like 'Now we added a new tag to our GTM-container to track those custom events when a 'trackTrans' object is present on the dataLayer.':Publishing the modified container
  9. At the very end of the setup process practice the good habit of continuous testing. Install Google's very handy Tag Assistant Chrome-extension, open a new tab on which you enable this TA, visit your web store, make an order and watch whether if a new type of hit, 'transaction' appears or not:Final testing of inserted tags

    If it's there, then now can expect transactional data (eg. cart items, SKUs, prices, etc.) to appear in your GA reports under the Ecommerce menu.

Help improve this page

Page status: Needs work

You can: