WP E-Commerce Analytics is Alive!

Today is a good day. With the help of Lee Willis I have created my first WordPress plugin for WP E-Commerce adding Google Analytics E-Commerce tracking support to Instinct’s WP E-Commerce shopping cart solution.

Please support my work by donating what you can to continue my efforts, donations are accepted in the footer of this page.

Download

Download WP E-Commerce Analytics

Adding Google Analytics E-Commerce Tracking to WP E-Commerce

Over in the Instinct support forums I’ve been contributing towards implementing Google Analytics E-Commerce Tracking support for WP E-Commerce, I made some progress and am sharing my work below.

My solution only notifies Google Analytics of ‘successful’ transactions and does not support, as yet, the following:

  • total tax
  • state details
  • failed or abandoned sales

Note: This is an intermediate patch requiring PHP and limited phpMyAdmin knowledge, if you’re unsure of anything mentioned below I can install this for you, contact me for more details.

Instructions

  1. Backup transaction_result_functions.php within /wp-content/plugins/wp-e-commerce/ as you will need the original if anything goes wrong.
  2. Open transaction_result_functions.php with your favourite text editor
  3. On line #288, immediately after if($sessionid != null){ paste the contents of my patch
  4. On line #298 replace the Google Analytics tracking ID (e.g. UA-########-#) to your own
  5. Save changes

Test your new Google Analytics E-Commerce Tracking integration by successfully performing a live purchase and viewing the source code of the Transaction Results page, it should look similar to my sample below.

try {
var pageTracker = _gat._getTracker("UA-########-#");
pageTracker._trackPageview();
pageTracker._addTrans(
"3",
"Visser Labs",
"1.00",
"0.00",
"0.00",
"Mountain Creek",
"",
"AU"
);
pageTracker._addItem(
"3",
"0000000001",
"Assassin's Creed II",
"Xbox 360",
"1.00",
"1"
);

That’s it. In later versions I will add an Administrator interface and/or package this as a plugin for WP E-Commerce.

Download

Google Analytics E-Commerce Tracking for WP E-Commerce