3

I'm having an issue with the built-in GTM support in 1.14.2+.

  • We have enabled the GTM support
  • We have input the correct GTM container ID
  • We have enabled Enhanced Ecommerce in the Google Analytics package
  • We have set up Universal Analytics tagging on all page views in GTM
  • We have set up UA Conversion Tracking on the success page in GTM

However, we still do not get the UA conversion in GA. It never registers.

0

3 Answers 3

5

So I had the pleasure of attempting to set these up (with the lack of offical docs) and seem to have it working now.

My understanding is that rather than using tracking based on success page, we need to use the events, so for conversions Magento fires a "purchase" event that we need to hook onto.

So along with the PageView tag I have this Purchase tag, where Fire On is a Custom Event with the name "purchase" which is what Magento fires on the success page.

enter image description here

The post below from branchlabs really helped me, however I ended up splitting each event into a new tag so that it's easier to see the differences within analytics as per the official docs below. Seems to be working.

http://branchlabs.com/magento-development/how-to-set-up-google-tag-manager-for-magento#create-a-tag-for-page-views

http://merch.docs.magento.com/ee/user_guide/marketing/google-universal-analytics-enhanced-ecommerce.html

2
  • Eureka! That was the issue. We weren't looking at the data layer for a custom 'event' name. It is indeed 'purchase'.
    – philwinkle
    Commented Dec 16, 2015 at 16:52
  • This was so helpful and fixed my specific problem as well.
    – Head
    Commented Mar 8, 2017 at 0:56
2

In most implementations, you should enable Enhanced Ecommerce on each of your Universal Analytics pageview or event tags. You have two options for enabling Enhanced Ecommerce in the tag editor screen of the web interface:

  • Implement using the Data Layer (Recommended)
  • Implement using a Custom JavaScript Macro

For Data Layer you need to create the following different data layers on your Magento website -:

  • Product Impressions
  • Product Clicks
  • Product Detail Impressions
  • Add / Remove from Cart
  • Promotion Impressions
  • Promotion Clicks
  • Checkout
  • Purchases
  • Refunds

Example data layer for product impressions -:

<script>
// Measures product impressions and also tracks a standard
// pageview for the tag configuration.
// Product impressions are sent by pushing an impressions object
// containing one or more impressionFieldObjects.
dataLayer.push({
  'ecommerce': {
    'currencyCode': 'EUR',                       // Local currency is optional.
    'impressions': [
     {
       'name': 'Triblend Android T-Shirt',       // Name or ID is required.
       'id': '12345',
       'price': '15.25',
       'brand': 'Google',
       'category': 'Apparel',
       'variant': 'Gray',
       'list': 'Search Results',
       'position': 1
     },
     {
       'name': 'Donut Friday Scented T-Shirt',
       'id': '67890',
       'price': '33.75',
       'brand': 'Google',
       'category': 'Apparel',
       'variant': 'Black',
       'list': 'Search Results',
       'position': 2
     }]
  }
});
</script>

Here is the Magento module which creates data layers for all the above points -:

http://www.scommerce-mage.co.uk/enhanced-ecommerce-tracking-with-google-tag-manager.html

If you don't want to buy above module then you can do it using a Custom JavaScript Macro -:

// A custom JavaScript macro that returns an ecommerceData object
// that follows the data layer syntax.
function() {
  var ecommerceData = {
    'ecommerce': {
      'purchase': {
        'actionField': {'id': 'T12345'},
        'products': [
            // List of productFieldObjects
        ],
        ... // Rest of the code should follow the data layer syntax.
     }
  };
  return ecommerceData;
}

If you choose to use a custom JavaScript macro instead of the data layer, select Enable Enhanced Ecommerce Features and set the read data from macro option.

Hope it helps!

0

Ensure you have a dataLayer setup in your tracking code and that you setup a trigger to pass the event data.

GAEvent Trigger

Event Variables

GAEvent

You push the tracking event into the dataLayer thusly:

dataLayer.push({'event': 'trackEvent', 'eventCategory': 'This is your category title', 'eventAction': 'this is your action title', 'eventLabel': 'this is your label', 'eventValue':'1' });
5
  • The GAevent - this is fired by Magento's GTM? We currently have a GTM trigger for a URL containing 'checkout/onepage/success'. Any other thought there?
    – philwinkle
    Commented Nov 20, 2015 at 21:21
  • I updated the original answer to show how to push the trackEvent into the dataLayer
    – Eirik
    Commented Nov 20, 2015 at 21:45
  • Make sure it is called after the dataLayer is instantiated.
    – Eirik
    Commented Nov 20, 2015 at 21:46
  • What specifically are you trying to pass through, a purchase or just merely record the checkout event?
    – Eirik
    Commented Nov 20, 2015 at 21:55
  • Checkout event is not being recorded as a success
    – philwinkle
    Commented Nov 20, 2015 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.