Menu Content

Support

> Forums, FAQs & Paid Support
Welcome, Guest
Username Password: Remember me

Testing E-Commerce tracking and fixing code
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Testing E-Commerce tracking and fixing code

Testing E-Commerce tracking and fixing code 13 years, 3 months ago #23320

  • martguy
_gaq.push(['_setAccount', 'UA-XXXXXX-X']); << change to your account

<html>
<head>
<title>Receipt for your clothing purchase from Acme Clothing</title>
<script type="text/javascript">
 
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXX-X']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
'1234', // order ID - required
'Acme Clothing', // affiliation or store name
'11.99', // total - required
'1.29', // tax
'5', // shipping
'San Jose', // city
'California', // state or province
'USA' // country
]);
 
// add item might be called for every item in the shopping cart
// where your ecommerce engine loops through each item in the cart and
// prints out _addItem for each
_gaq.push(['_addItem',
'1234', // order ID - required
'DD44', // SKU/code - required
'T-Shirt', // product name
'Green Medium', // category or variation
'11.99', // unit price - required
'1' // quantity - required
]);
_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
 
(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>
</head>
<body>
 
Thank you for your order. You will receive an email containing all your order details.
 
</body>
</html>


If there're anything appear in your analytics e-commerce then..

change getVMTrackCodeOld() to getVMTrackCode()
{I force the code to use new analytics code}

Next problem, $this->purchase never tricked on my cart.

$this->purchase = (JRequest::getVar('option') == 'com_virtuemart'
&& (JRequest::getVar('page') == 'checkout.index'
&& JRequest::getVar('checkout_last_step') == 3));

Then I change to


$this->purchase = (JRequest::getVar('option') == 'com_virtuemart'
&& (JRequest::getVar('page') == 'checkout.index'
&& JRequest::getVar('checkout_stage') == 4));

I assume the code will track on confirmation page (before press confirm and go to paypal)

And Adword Conversion code (filled in backend) i use this code

<!-- Google Code for Purchase Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = REPLACEWITHYOURCODE;
var google_conversion_language = "en";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "f2yaCJHz6AIQ_5PGyQM";
var google_conversion_value = %s; // <<----- put %s here
/* ]]> */
</script>
<script type="text/javascript" src="www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;"><img height="1" width="1" style="border-style:none;" alt="" src="www.googleadservices.com/pagead/conversi...;script=0"/>
</div>
</noscript>

Any suggestion welcome.
  • Page:
  • 1
User Login Empty