[checkout] track ecommerce transactions with google analytics

bchantre

Joined: 2005-11-16
Posts: 55
Posted: Wed, 2008-09-10 18:57

Hello,

To track ecommerce transactions with google analytics, we need to send some informations about an order through a javascript function (see below).

Is there a way to send those informations when order is completed with checkoutemail or checkoutpaypal?

<script type="text/javascript">
  var pageTracker = _gat._getTracker("UA-XXXXX-1");
  pageTracker._initData();
  pageTracker._trackPageview();

  pageTracker._addTrans(
    "1234",                                     // Order ID
    "Mountain View",                      // Affiliation
    "11.99",                                    // 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();
</script>

Google's how to

Thank you for your suggestions