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
Forum Search
Google Site Search
 All Forums
 Technical
 ASP (Windows server) versions
 Using Google Analytics Code In Google Tag Manager
Author « Topic »  

madhouse8
Starting Member

2 Posts

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

Posted - 08/20/2020 :  12:22:37  
Do you have any information on how to put the ECT Google Analytics Ecommerce Code into Google Tag Manager?

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
<% 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>

When I try to put this code in Google Tag Manager I get the error message:

JavaScript compiler error,
Error at line 5, character 2: Parse error. primary expression expected

I think it's referring to this line:
<% print googleanalyticstrackorderinfo%>(function() {

Vince
Administrator

42983 Posts

Posted - 08/21/2020 :  01:04:49  
I've never used Google Tag Manager to tell the truth but that line will change according to the contents of the cart and it does seem to be the line that G. is complaining about. But can you put dynamically created scripts in this Tag Manager then? Could you maybe ask Google support?

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

madhouse8
Starting Member

2 Posts

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

Posted - 08/24/2020 :  19:37:32  
Yes this needs dynamic script but I finally got it to work by just leaving it out of tag manager and adding the code to all my pages. Works fine like this.

I am having another issue with the Facebook Pixel Event Code. This code should pull the the order purchase data from the thanks.asp page.

fbq('track', 'Purchase', {currency: "USD", value: 30.00});

How do I get the dynamic variables for (product name, quantity, and purchase price totals)

RJ

dbdave
ECT Moderator

USA
10507 Posts

Posted - 08/25/2020 :  04:23:46  
Hi, this is the variable you want for the order total - <%= ordTotal %>

fbq('track', 'Purchase', {currency: "USD", value: <%= ordTotal %>});

Thanks,
David
  « 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