Thursday, 29 January 2015

We occasionally get questions from our new users of Google Checkout. They've read all about how to track e-commerce transactions with Google Analytics; now they would like more specific details for implementing tracking.

Merchants can use Google Analytics to track buyers who leave their sites to complete the checkout process with Google Checkout. With the help of Google Analytics, Google Checkout merchants will be able to separately track activity on:

1) the Login page, or the first page to appear after a buyer click the Google Checkout button,

2) the Place Order page, which appears after the buyer logs in to Google Checkout, and

3) the Order Confirmed page, which appears after the buyer places the order.

Additionally, Google Analytics will provide a wide range of information on every order placed. Like current Google Analytics e-commerce tracking implementations, this will include the order-ID, total price, tax, shipping charge, city, state/region, and country. It'll also include the item-specific information such as product name, price, and quantity.

There are two methods that Google Checkout merchants use to post their Checkout API requests so that Google Analytics can include Checkout data. Each method requires a slightly different Google Analytics implementation. Today we'll give you a technical overview of the first method, and then will include the second method in our next post.

Method 1 for posting Checkout API requests into Google Analytics
In a standard Checkout API request, a form on the merchant's web page displays a Google Checkout button while containing an encoded version of the customer's shopping cart. When the user clicks the Google Checkout button, the form posts the encoded shopping cart data directly to Google Checkout. To track shoppers while using this method, merchants will need to make the following changes:

1. Once you have Google Analytics set up and tracking your website, add the JavaScript call below to each page that displays a Google Checkout button. HOWEVER, before making this call, your page should display all of the forms that display Google Checkout buttons. Your page should also include the standard Google Analytics tracking code before making this call.
 <script src="http://checkout.google.com/files/digital/urchin_post.js" type="text/javascript"> </script> 

2. Add the following hidden input field to each form on your site that displays a Google Checkout button:
 <input type="hidden" name="analyticsdata" value=""> 

3. For each form that displays a Google Checkout button, add an onsubmit attribute to the <form> element. The onsubmit element should call the setUrchinInputCode JavaScript function as shown in the following example:
 <form action="..." method="POST" onsubmit="setUrchinInputCode();" > 

For more information, take a look at help document, Using Google Analytics to Track Google Checkout Orders, and stay tuned for Part 2.