1Shoppingcart – Tracking Google Analytics With Custom Thankyou Page

1Shopping Cart is a bit tricky system, but it does allow you to set your own thankyou page and passes all required variables to integrate google analytics to further feed data in ecommerce section of analytics.

Google Analytics Default Stats

We can help you with integerating 1Shoppingcart for your website. Fill in form on the right or send an email to integrations@escalateseo.com

Here is a complete DIY code that you need integrate to start tracking with your custom thankyou page.

First set the custom thankyou page url from your 1shoppingcart admin panel.

Enter the target url for : Thank You URL
Click Save

This is where your customers will be redirected after successful orders.

Now we need to put this code in your thankyou page

Capturing the variables passed by 1Shoppingcart on thankyou page:

$orderID = $_POST[“orderID”];
$Total = $_POST[“Total”];
$tax = $_POST[“tax”];
$shipping = $_POST[“shipping”];
$city = $_POST[“city”];
$state = $_POST[“state”];
$country = $_POST[“country”];
$sku1 = $_POST[“sku1”];
$product1 = $_POST[“product1”];
$price1 = $_POST[“price1”];
$quantity1 = $_POST[“quantity1”];

Preparing Push To Google Analytics [integrating transaction header]

var _gaq = _gaq || []; _gaq.push([‘_setAccount’, ‘UA-xxxxxxxxxxx-1’]);
“<?php echo $orderID; ?>”, // order ID – required
“MyDomainIdentifier”, // affiliation or store name like Escalate SEO
“<?php echo $Total; ?>”, // total – required
“<?php echo $tax; ?>”, // tax
“<?php echo $shipping; ?>”, // shipping
“<?php echo $city; ?>”, // city
“<?php echo $state; ?>”, // state or province
“<?php echo $country; ?>” // country ]);

Once header is set, we need to transmit products details as under:

“<?php echo $orderID; ?>”, // order ID – required
“<?php echo $_POST[“sku1″]; ?>”, // SKU/code – required
“<?php echo $_POST[“product1″]; ?>”, // product name
“Training”, // category or variation, we do not get category from 1shoppingcart so hard code to something more appropriate.
“<?php echo $_POST[“price1″]; ?>”, // unit price – required
“<?php echo $_POST[“quantity1″]; ?>” // quantity – required ]);

Pushing data to google analytics to feed the ecommerce section:

_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); })();


Wait till the next order comes and you will start seeing activity under ecommerce section in google analytics as the image below shows.

Google Analytics Ecommerce Conversion Rates

Now that you have integrated analytics with variables sent by 1shoppingcart for one product, it may be easy to replicate the procedure “transmit products” by iterating for more products if the order had more than one products ordered.

If there is still some error, then please use the form on the right to contact me and I will help you out.


Tags: ,

Facebook Comments:

Leave A Reply (2 comments so far)

The comments are closed.

No comments yet