Magento Google Tag Manager Ecommerce

This one took a while to figure out and get it reporting correctly, the idea of Google Tag Manager is to make things easier – I’m not convinced!

Firstly you need to install this plugin from Magento Connect

You need to use this one as its the only one that has the data layer support that you need (after a little tweaking)

Once installed in the configuration make sure that Data layer: Transactions is enabled

Go to the file


Find protected function _getTransactionData() and look for the line ‘transactionId’ => $order->getIncrementId(), roughly line 74 above this line insert the line ‘event’ => ‘trackTransaction’,

Thats the magento side of things sorted now onto Google Tag Manager.

Login to Google Tag Manager create a new tag, maybe called it GA Conversion

Tag Type: Universal Analytics

Track Type: Transaction

Add a firing rule name it whatever you like mines Checkout Success, then add a condition of {{event}} equals trackTransaction

This then links trackTransaction from the array in the datalayer to Google Tag Manager, put a transaction through and wait half an hour as it takes a little bit of time to display in Google Analytics Ecommerce Tracking.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Notice: ob_end_flush(): failed to send buffer of zlib output compression (0) in /home/wwwwebam/public_html/blog/wp-includes/functions.php on line 4339