Comments on: Collect Enhanced Ecommerce Values into GTM Variables https://mixedanalytics.com/blog/collect-enhanced-ecommerce-values-into-gtm-variables/ APIs, Sheets, and Analytics Thu, 25 Feb 2021 08:43:31 +0000 hourly 1 https://wordpress.org/?v=6.5.5 By: Ana https://mixedanalytics.com/blog/collect-enhanced-ecommerce-values-into-gtm-variables/#comment-20498 Sun, 15 Nov 2020 01:53:39 +0000 https://mixedanalytics.com/?p=7462#comment-20498 In reply to Jayapriya.

Thanks for the message, I'm glad it was useful 🙂

]]>
By: Jayapriya https://mixedanalytics.com/blog/collect-enhanced-ecommerce-values-into-gtm-variables/#comment-20497 Sun, 15 Nov 2020 00:05:40 +0000 https://mixedanalytics.com/?p=7462#comment-20497 Awesome! Exactly what I was looking for. Thanks a ton.

]]>
By: Ana https://mixedanalytics.com/blog/collect-enhanced-ecommerce-values-into-gtm-variables/#comment-10868 Wed, 09 Oct 2019 17:02:05 +0000 https://mixedanalytics.com/?p=7462#comment-10868 In reply to Vijay.

Yeah, my example in that post only shows how to track the purchase, not the entire checkout funnel. It could be modified, but as written it seems it's not a good fit for what you're looking to accomplish.

]]>
By: Ana https://mixedanalytics.com/blog/collect-enhanced-ecommerce-values-into-gtm-variables/#comment-10867 Wed, 09 Oct 2019 16:59:36 +0000 https://mixedanalytics.com/?p=7462#comment-10867 In reply to Anonymous.

Sorry, I'm not 100% sure what you mean by recording the purchase but not the transaction/product details on a purchase. If you mean the product details aren't being captured, there's probably some problem with your {{JS – Product SKU List}} variable. But in general, ecommerce tracking can be complex with a few potential points of failure, so it's hard to diagnose without actually seeing it.

Could you please do a test transaction and check a) output from the GA debugger and b) output in the GTM preview pane? This will show exactly which part of the process has an issue. If you send me a screenshot of those 2 items I'll be happy to take a look too.

]]>
By: Vijay https://mixedanalytics.com/blog/collect-enhanced-ecommerce-values-into-gtm-variables/#comment-10845 Tue, 08 Oct 2019 18:10:21 +0000 https://mixedanalytics.com/?p=7462#comment-10845 In reply to Ana.

I also checked out the post about DOM scraping. Interesting and a lot easier but I am afraid if doing that will affect the Ecommerce checkout behavior funnel as I read that the funnel only records transactions using the "purchase" action? Please correct me if I am wrong.

]]>
By: Anonymous https://mixedanalytics.com/blog/collect-enhanced-ecommerce-values-into-gtm-variables/#comment-10843 Tue, 08 Oct 2019 17:31:23 +0000 https://mixedanalytics.com/?p=7462#comment-10843 In reply to Ana.

Thank you for the syntax correction Ana! I am able to record the purchase but I am not able to record the transaction and product details on a purchase. Should I be including any other step apart from those mentioned above to make my method work?

]]>
By: Ana https://mixedanalytics.com/blog/collect-enhanced-ecommerce-values-into-gtm-variables/#comment-10795 Sun, 06 Oct 2019 15:26:14 +0000 https://mixedanalytics.com/?p=7462#comment-10795 In reply to Anonymous.

Hey there, thanks for the comment. Your method is possible but I think you have some syntax errors in your code. Try something like this:

function() {
var ecommerceData = {
'ecommerce': {
'purchase': {
'actionField': {
'id': '{{JS – Purchase Transaction ID}}',
'revenue': '{{JS – Purchase Revenue Total}}',
'tax':'{{JS – Purchase Tax Amount}}'
},
'products': {{transaction products}}
} } }
return ecommerceData;
}

You may also want to check out my post DOM Scraping Together a Datalayer for Google Analytics Ecommerce Tracking

Let me know how it goes!

]]>
By: Anonymous https://mixedanalytics.com/blog/collect-enhanced-ecommerce-values-into-gtm-variables/#comment-10776 Sat, 05 Oct 2019 16:35:12 +0000 https://mixedanalytics.com/?p=7462#comment-10776 Hi Ana,
Very interesting blog! Was able to understand the concept very easily compared to others. I am stuck at a point now, I am tring to record the ecommerce purchace with the transaction ID, revenue, tax, etc. I have created separate JS variables to record all those to collect dynamic values. My JS code is mentioned below but I am not able to make this work. Is it not possible to declare all the variables at once like below? or is there any other way to make this work better and I am also trying to record the product details like name and sku as well along with the transaction data.
Can i declare all those product variables too in the same way in the same JS variable?
And to note, at the tag level its an event tag and I am Reading data from this variable instead of selecting "Use data layer" option.
I really hope you could help solve this.

function()
{return {'ecommerce':
{'purchase':
{'actionField':
{'id': '{{JS - Purchase Transaction ID}}',
{'revenue': {{JS - Purchase Revenue Total}}},
{'tax': {{JS - Purchase Tax Amount}}}},

{'products':
{'name': '{{JS - Product SKU List}}'},
{'id': '{JS - Product SKU List}}'},
}}};}

Thank you!

]]>
By: Ana https://mixedanalytics.com/blog/collect-enhanced-ecommerce-values-into-gtm-variables/#comment-10124 Mon, 09 Sep 2019 05:54:44 +0000 https://mixedanalytics.com/?p=7462#comment-10124 In reply to Ghazi.

Hey Ghazi! The data layer just reflects GA's Enhanced Ecommerce data layer requirements as described in Google's documentation.
The 'purchase' object contains data about the transaction as a whole, while the 'products' array shows data about each individual product.
If you're looking to extract product category, you could do a data layer variable like this: ecommerce.purchase.products.0.category
However, that will only work if there's only a single product category for each purchase. If you have multiple categories and would like to get a list of them, you'd need to use a script like in the example above. Just replace 'id' with 'category' to get the product category.

]]>
By: Ghazi https://mixedanalytics.com/blog/collect-enhanced-ecommerce-values-into-gtm-variables/#comment-10098 Sun, 08 Sep 2019 13:36:53 +0000 https://mixedanalytics.com/?p=7462#comment-10098 wow, this is amazing.
can you explain the logic of setting up the value under products data layers, what is different from the variables under purchase
also I would like to use product category in the data layers how can I set up this variable, I have attached a screenshot

]]>