Tracking E-Commerce


Using Google Analytics to track your e-commerce transactions can provide an extremely powerful reporting tool to your Web-based business. Detailed financial history can be tracked against Web site performance and geography. For example, you can find out what area of the country is spending most of the money on your site and which of your pages interests your customers the most.

Enabling e-commerce tracking on your site is a two-step process. To begin, follow these steps:

  1. Log in to your Analytics account.

  2. Find the profile you want to track, and click the Edit link.

  3. On the Profile Settings page, click the edit link along the top of the Main Website Profile information.

  4. Select Yes next to E-Commerce Website. You may notice that in the Available Reports section the E-Commerce Analysis report is selected.

  5. Click the Save Changes button.

You have completed the first step. To continue, you must be able to edit your e-commerce Web pages so that you can include special Javascript tracking code into the receipt page. The simplest way to add this code is to place the following into the HTML of your receipt Web page.

Tip 

Your receipt may be generated by scripts and may not appear as a separate Web page. If that is the case, you need to edit the script that generates the receipt to write this code into the body of the receipt page.

 <script src="/books/2/150/1/html/2/http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript">  _uacct="UA-xxxx-x";  urchinTracker(); </script>

The _uacct=”UA-xxxx-x” in the preceding code needs to be replaced with your actual Analytics account number. You can find this in the tracking script that you added to each of your pages. You aren’t finished editing the HTML code, however. You next need to add an invisible form.

Next, somewhere in the receipt below the tracking code, the following lines need to be written by your engine. Everything in italics should be replaced by actual values, as described in the Parameter Reference that follows.

 <form style="display:none;" name="utmform"> <textarea >UTM:T|order-id|affiliation| total amt|tax amt|shipping amt|city|state|country UTM:I|order- id|product id/sku|product name|category|price| quantity </textarea> </form>

The form is made invisible by setting the display parameter to none. The invisible form is then named utmform.

The form is written in a single textarea tag and begins with a single transaction line, starting with UTM:T. The order-id is your company’s identification for this order. You also can set an optional partner affiliation field. If you don’t set this, you still need to leave this place blank like this: | |.

Type the total amt of the transaction, making certain not to use commas in the number. Type the tax amt and shipping amt. These may be zero based on whether you are charging tax or shipping. Type the city, state, and country associated with this order. Google does not need an exact address, only a general location for geographical tracking. These parameters should all appear on a single line in your text area. This ends the transaction line portion. You should now enter as many line transactions UTM:I as you have items in the transaction, one per line.

For each item line, type the order-id, which should match the order-id in the transaction line. Next, type the product id/sku. This is your company’s product identification or stock keeping unit. Follow this with the actual text name of the product, Rubbon Hair Gel, for example. Type a category for your product if it has one. Type the unit price and the quantity ordered.

Note 

Make certain to close your <textarea> tag with </textarea>.

After the form is submitted, you must take one additional step in the next page, calling a special function that records the transaction. This is called the utmSetTrans function. You can set this function in two different ways. The simplest is placing a call to this function in the <body> tag of the Web page loaded after the form submission. It should look like this:

 <body onLoad="javascript:__utmSetTrans()">

Another way you can call the utmSetTrans function is by creating a separate Javascript tag making certain it is called after the form:

 <script language="text/javascript"> __utmSetTrans(); < /script>

This completes the setup necessary for e-commerce tracking. It’s a little complex, and if you are not comfortable with script programming, you may need to enlist assistance in this step. It’s worth it for the value you receive from Analytics.



Google Power Tools Bible
Google Power Tools Bible
ISBN: 0470097124
EAN: 2147483647
Year: 2004
Pages: 353

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net