google-analyticsdrupal-7google-tag-manageruniversal-analyticsdrupal-commerce

Drupal google tag manager e-commerce data not flowing


I'm having some trouble setting up Universal Analytics in combination with Google Tag manager in Drupal more specific to the e-commerce data. Normal google analytics is working but I can't seem to get the e-commerce data to show up. This is my configuration:

Drupal side:

Google Tag manager side:

Universal analytics side: On view level I enabled the e-commerce setting and enhanced e-commerce setting. Normal page traffic is flowing into Universal analytics verifying the tag is working.

When debugging the page calls with the Tag assistant I can verify that upon completion of an order data is being sent to the tag, this is the sent data:

[
  {
    "event": "trackTrans",
    "transactionId": "606",
    "transactionAffiliation": "Name Hidden",
    "transactionTotal": 50,
    "transactionTax": 0,
    "transactionShipping": 0,
    "transactionProducts":     [
      {
        "sku": "211",
        "name": "211",
        "category": "",
        "price": 50,
        "quantity": 1
      }
    ]
  },
  {
    "gtm.start": 1465502292047,
    "event": "gtm.js"
  },
  {
    "event": "gtm.dom"
  },
  {
    "event": "gtm.load"
  }
]

I'm pretty new to Google Tag manager but this are my observations.

The analytics data is sent to the Tag => shouldn't it be sent to the Analytics code instead? Or does the tag manager take care of this?

The documentation mentions this:

Add a tag of type Universal Analytics; track type of Page View or Event.

Does this imply the tag also needs to fire on an event like checkout completion? Or is it a real "OR" case where you can decide for yourself to use either pageview or event.

If you need more information I will be happy to provide so!

Thank you for helping out.


Solution

  • A few things to note regarding the GTM setup, which may help:

    Since you're using standard Ecommerce (ie. not Enhanced Ecommerce), your Track Type needs to be Transaction, not Pageview or anything else. It will follow that you won't have the option to check the Enhanced Ecommerce checkbox once you select that track type. There's also no further configuration regarding the dataLayer.

    The analytics data is sent to the Tag => shouldn't it be sent to the Analytics code instead? Or does the tag manager take care of this?

    The analytics data (assuming you mean the dataLayer) is read by the tag. GTM will handle everything for you (provided things are configured correctly).

    Everything else should follow and you shouldn't need to do anything else. Your firing rule for the tag could be the event you are pushing in trackTrans.

    If you need to use Enhanced Ecommerce, then you would need to restructure/redo your entire dataLayer (unfortunately, but for the better, as you'd get better and more insights into shopping and checkout behaviours in GA).