Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
 All Forums
 Technical
 PHP (Unix / Linux / Apache) versions
 Ecommerce Tracking HELP?!!
Author « Topic »  

cpcsigns
Advanced Member

USA
139 Posts

Pre-sales questions only
(More Details...)

Posted - 03/16/2021 :  14:18:33  
We are clearly missing a piece of the puzzle on the Google tracking our ecommerce purchases.

www.cpcsigns.com

I think we need a transaction tag.. but I can't for the life of me figure it out!! Can anyone help or send me to someone that can fix it for us?



Michelle L Cosen

dbdave
ECT Moderator

USA
9761 Posts

Posted - 03/16/2021 :  14:28:30  
Hi Michelle, have you added any code for the tracking?

On the PHP parameters page, there is these steps...

quote:
Add Google Analytics ecommerce code

If you want to track orders using Google Analytics add the following...

$googleanalyticsinfo=TRUE;
$usegoogleasync=TRUE;

... then open your php pages and just above the closing </body> tag add the following...

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
<?php print @$googleanalyticstrackorderinfo?>(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);})();
</script>

If you want use Google Analytics Universal Code you will need to be running Version 6.3 and add the following to vsadmin/includes.php

$usegoogleuniversal=TRUE;

You will also need this code on thanks.php

<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create','UA-XXXX-Y','auto');
ga('send','pageview');
ga('require','ecommerce','ecommerce.js');
<?php print @$googleanalyticstrackorderinfo?>
</script>

for Wordpress users you would need this in footer.php

<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create','UA-XXXX-Y','auto');
ga('send','pageview');
ga('require','ecommerce','ecommerce.js');
<?php print @$GLOBALS['googleanalyticstrackorderinfo']?>
</script>

copcars
Starting Member

USA
24 Posts

Posted - 11/23/2022 :  19:27:39  
Hi Dave...I know you answered a question for me earlier today, and I'm continuing my research on the new Google Analytics 4.

Question: In the code listed above, the UA tracking ID is used (UA-XXXXX-X). Can I replace this with my new G- tracking ID?

Thanks

Eric Payne

midvalleydrifter001
Ecommerce Template Expert

USA
842 Posts

Posted - 11/23/2022 :  21:39:42  
You need the following format for GA4

<script async src="https://www.googletagmanager.com/gtag/js?id=G-AAAAAAAAAA"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-AAAAAAAAAA');
</script>


The below link explains this pretty well.

https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=114351&SearchTerms=ga4

Patrick


Edited by - midvalleydrifter001 on 11/23/2022 21:40:30

copcars
Starting Member

USA
24 Posts

Posted - 11/23/2022 :  21:41:48  
Thank you!

Eric Payne
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000