Here's how I got the data to pass to GA.
The data layer I'm using looks like this and goes in the confirmation page as raw HTML. It is essentially what has already been posted. Note that according to Google SKU is required.
window.dataLayer = window.dataLayer || 
'transactionId': '[MM_Order_Data name="id"]',
'transactionTotal': [MM_Order_Data name="total"],
'transactionShipping': [MM_Order_Data name="shipping"],
'sku': '[MM_Order_Data name='productId']',
'name': '[MM_Order_Data name="productName"]',
'price': [MM_Order_Data name="subtotal"],
I then created a google tag manager account.
I then used https://wordpress.org/plugins/duracelltomi-google-tag-manager/ to insert my tag manager id into the GTM container in the footer.
Create a container for www.yoganatomy.com and published.
Create A New Trigger
Name it what you want...
Choose Event > page view
Configure Trigger > DOM Ready
Fire On Page URL > Contains https://www.yourdomain.com/confirmation/
Create A New Tag
Name it what you want...
Choose Product > Google Analytics
Choose Tag Type > Universal Analytics
Configure Tag > UA tracking Code and then Track Type TRANSACTION
Fire On > Choose more and then select the trigger that you created
While logged into GTM and using chrome browser, it automatically displayed a tag manager panel at the bottom of the window.
I logged out of admin and used a test account and watched the tag fire after checkout. In about 5 minutes it showed up in my GA account as a transaction with all details.
I hope this helps someone else.
Sir, I would require your help here implementing ecommerce with the help of GTM. What I need to know is could I just copy paste your data layer code mentioned with my domain name in it? Are there any changes that are to be made to your data layer except for the domain name? I'm a newbie and I need to pass those values in my Analytics account using GTM.
As far as I know, the instructions above still work. I have made no change to my website and am receiving all data.
Just follow the instructions and DEFINITELY replace the domain name.
The code, exactly how I pasted it here still works on my site. I'm not here to do support on it.
If you think it needs to be changed or if you have implemented it and it's not working, then please do update us.
Please specify the exact changes made AFTER testing.
I'm attempting to do this at present. But am getting this error code:
Can you please confirm where exactly you are putting this code? Is it inside the tag manager and you make a custom html
I just copied and pasted so cannot see where the issue is.
Ummm... I don't work for MM or really do support.
I can tell you this though... You didn't read carefully. You put that data layer in tag manager. NO. It goes in as html on the MM confirmation page on your website!
Yes I noted that after I wrote this. Thanks for replying!
thanks for sharing this information. this info is good for me. keep posting these type of posts.