Another Google offering is Google Analytics, a useful web-based application for monitoring website analytics, such as visitor numbers, visitor lengths, popular pages, sources of traffic, and so on.
One particularly useful feature within Google Analytics for us is its e-commerce functionality. At minimum, we could add some code to indicate an order has been placed; this would allow us to look at data such as how many visits it took to make a purchase. We can of course go into more detail, supplying other information such as how much the order was for, and so on.
Google Analytics works by having a small piece of JavaScript inserted at the bottom of every page on our site.
To sign up for Google Analytics, we simply need to:
1. Visit http://www.google.com/analytics/ and sign up.
2. Click on Add Website Profile".
4. Copy the tracking code generated, and put that into our website's footer.
5. View the profiles list, and click on Edit for our website profile.
6. Under Main Website Profile Information, click on Edit.
7. Select Yes, an e-commerce Site.
We now have an account set up for e-commerce, and the tracking code is installed; next we need to track e-commerce transactions.
To track e-commerce sales in our store, we can record transaction details and item details, and then submit this information to Google Analytics.
The information is all captured into a JavaScript function call, which sends the data to the Analytics' server. The following JavaScript needs to go after the pageTracker._trackPageview()
; from our initial tracking code.
To add the transaction, we must at least store:
The order ID
The total cost of the order (excluding shipping)
We can also record:
Affiliation or store name
Tax costs
Shipping costs
Customer's city
Customer's state or province
Customer's country
This is reflected in the JavaScript as follows:
For each item within the transaction, we must record:
We can also record:
The product name
The category or variation of the product
This is reflected in the JavaScript as follows:
pageTracker._addItem( "111", // order ID - necessary to associate item with transaction "P1", // SKU/code - required "Fake Water Jug", // product name "Large", // category or variation "10.50", // unit price - required "1" // quantity - required );
Tracking number of sales (but nothing else) — Analytics Talk — http://www.epikone.com/blog/2008/06/25/google-analytics-e-commerce-tracking-pt-3-why-everyone-should-use-it/
Tracking lead generation forms (http://www.epikone.com/blog/2008/07/02/google-analytics-e-commerce-tracking-pt-4-tacking-lead-gen-forms/)
Tracking API: e-commerce (http://code.google.com/apis/analytics/docs/gaJS/gaJSApiEcommerce.html)