Tuesday, January 23, 2007

Tracking Google Checkout Sales, Part 2

Last post, we told you about a way to use Google Analytics to see your Google Checkout transaction data. Today, we'll show you the alternate method of posting Checkout API requests,

Method 2 for posting Checkout API requests into Google Analytics
In this method, the form that displays the Google Checkout button submits to another URL on the merchant’s website. That URL hosts an application that creates a Checkout API request, executes a server-to-server POST request, and lastly captures Google’s response to that request. The response contains the Google Checkout URL to which the customer should be redirected. To track shoppers while using this method, merchants will need to make the following changes:

1. 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 you make 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();" > 

4. Modify the form handler on your site that executes when a user clicks a Google Checkout button. The form handler needs to extract the value of the analyticsdata field so that the value can be included in the Checkout API request.

5. Add the <analytics-data> element to your Checkout API requests. The element’s value should be the analyticsdata field captured by the previous step. The <analytics-data> element is a subtag of the <merchant-checkout-flow-support> element.ut transactions.

The implementation details above will allow your Google Analytics account to track your Google Checkout transactions. If you would like an even more detailed explanation, along with screen shots and specific examples for each situation, we recommend checking out
this excellent resource that the Google Checkout API team has put together for you.

No comments:

Post a Comment