2
votes

I am preparing a developer brief to implement Google Tag Manager with Datalayer and Enhanced ecommerce data included in it. I referred to Google Tag manager Enhanced ecommerce guide and Enhanced ecommerce data types specification.

What I want to know is whether the Enhanced ecommerce data pushed via data layer object called "ecommerce" is also available as variables further on in Tag manager, or is it being pushed solely for the purpose of setting up Google Analytics tag in GTM? I want to use those parameters with other tags in GTM also.

The thing is I want to track more parameters about the product for example than the Google Tag manager Enhanced ecommerce guide is specifying. The article says that in order to track more product parameters, you can do that via custom dimensions ( 'dimension1': 'Additional parameter' ), but I assume those parameters are not available as variables in Tag manager later?

So is the correct way to specify those additional parameters outside the data layer object "ecommerce" or inside it?

Thank you.

1

1 Answers

2
votes

You can use the e-commerce dataLayer for other tags, as long as the push to the dataLayer contains an event (i.e. a key/value pair where the key is "event" and the name is used to create a custom event trigger). Some parts of the e-commerce dataLayer already have an event (i.e. for productClicks it's {'event': 'productClick'}), others have not (i.e. the e-commerce object for productImpressions). You can then use the e-commerce-object in all tags that are triggered at that event, or after it.

The same goes for any custom dimensions in the dataLayer. You would create the custom dimension in the GA backend in product scope and then add it to each product:

dataLayer.push({
      'event': 'productClick',
      'ecommerce': {
        'click': {
          'actionField': {
            'list': 'Search Results'
          }, // Optional list property.
          'products': [{
            'name': "test", // Name or ID is required.
            'id': "1234",
            'price': 12.33,
            'brand': "brand1",
            'category': "category1",
            'dimension1': "customValue1"
          }, {
            'name': "test", // Name or ID is required.
            'id': "1235",
            'price': 9.23,
            'brand': "brand2",
            'category': "category2",
            'dimension1': "customValue4"
          }]
        }
      });

You can then access the custom dimension values as part of the product object - e.g. for the custom dimension of the first product you could create a dataLayer variable "ecommerce.products.0.dimension1" ecommerce.click.products.0.dimension1 (that's not a typo - GTM uses an unusual notation for array indicies, namely that you access the index via the dot notation and not via brackets).