Setting up Data Layer for Ecom tracking in GA4
Hi, I've just installed the Google Tracking Manager code on my site and it seems to be connected and reading ok. I'd like to set up the Ecomm tracking. I've been following a tutorial on setting up the Data Layer required. I've kind of hacked together some code using existing Google Analytic code/variables from the built in x-cart module plus the example from the tutorial. Can someone take a look at what I've got to see if I'm even close to having what I need?
Code:
<script> the original GA code in x-cart google anyalytics module ecommerce section has some additional lines like below but not sure if I need those (mainly the ldelim and rdelim) or the {literal} tags. Code:
ga('ecommerce:addTransaction', {ldelim} |
Re: Setting up Data Layer for Ecom tracking in GA4
Looks like you might be missing a closing {/foreach}
|
Re: Setting up Data Layer for Ecom tracking in GA4
yeah I agree on the missing end foreach
Should be like this: Code:
<script> |
Re: Setting up Data Layer for Ecom tracking in GA4
Thanks Phil and Carrie, I haven't actually tried the code in my site yet. I need to get my development site back up to do some testing first.
|
Re: Setting up Data Layer for Ecom tracking in GA4
Do either of you already have this set up on your sites (or do you have gtag) for google analytics set up? I have the OLD universal analytics on my site still using ga() instead of gtag() so a bit of a confusing to try and get GA4 set up as well.
|
Re: Setting up Data Layer for Ecom tracking in GA4
Here is what I'm up to so far...
Code:
<!-- Global site tag (gtag.js) - Google Analytics --> |
Re: Setting up Data Layer for Ecom tracking in GA4
I'll be working on this soon for a website. If you want to drop us an email I can let you know how to do it when I'm done. (I'm afraid I'll forget otherwise) Just ask Luke to put it in 'quotes' and I'll see it and can give you instructions on what to do. I may write a blog post on it when I figure it all out.
Thanks, Carrie |
Re: Setting up Data Layer for Ecom tracking in GA4
That would be great. I'll do that. Thanks a lot.
|
All times are GMT -8. The time now is 11:01 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.