Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

arsenal

Members
  • Content count

    1
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    valdet
  1. arsenal

    Google Analytics module

    This is my first post here and I was having problems with Analytics module for quite some time. I managed to fix it and here is my observation Based on new ecommerce tracking support from Google, can someone confirm that this mod needs to be updated with latest changes. Here is the link: http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55528 In instructions it says to paste the following code to checkout_success.php <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-xxxxxxx-x"); pageTracker._initData(); pageTracker._trackPageview(); <?php include(DIR_WS_MODULES . 'analytics/analytics.php'); ?> </script> But the link above has different paramaters/varibles you name it <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-XXXXX-1"); pageTracker._trackPageview(); pageTracker._addTrans( "1234", // Order ID "Mountain View", // Affiliation "18.28", // Total "1.29", // Tax "5", // Shipping "San Jose", // City "California", // State "USA" // Country ); pageTracker._addItem( "1234", // Order ID "DD44", // SKU "T-Shirt", // Product Name "Green Medium", // Category "11.99", // Price "1" // Quantity ); pageTracker._trackTrans(); } catch(err) {}</script> therefore pageTracker._initData(); seems redundant Now if you compare what analytics.php has in bottom of its file when it calls functions, you see some of the data is missing Here is what bottom of analytics.php has pageTracker._addTrans( <?php echo $transaction_string; ?> ); <?php echo $item_string; ?> pageTracker._trackTrans(); If you compare to Google guidelines example above, you see there are some functions missing. I believe that teh correct code in bottom of analytics.php should be pageTracker._addTrans( <?php echo $transaction_string; ?> ); pageTracker._addItem( /// NEW <?php echo $item_string; ?> ); /// NEW pageTracker._trackTrans(); With these changes, my ecommerce reports are more reliable now and I can measure transactions in efficient way.
×