02 8413 6400Mon. - Fri. 9:00am-5:30pm

Your Google Analytics Questions Answered

Posted by in Analytics

I’m very pleased at the level of response to my post Tell Us! What Are You Looking For in Your Analytics? where I opened the proverbial floor to questions about getting the most out of your Google Analytics. So in no particular order here are my answers to the most commonly asked questions I received.

Most of your questions were to do with using Analytics to track website revenue/income.  You can do this in a few ways depending on your website. If you have an online store, you can do straight up E-Commerce Tracking, a 2-step process that involves editing some HTML.  If you don’t have an online store, but want to attach dollar values to certain goals, you can use normal Goal Tracking.

Now, I’m going to take you through how to set up both E-Commerce and normal Goal Tracking.

How Do I Set Up E-Commerce Tracking?

As mentioned, this is a 2 step process. First, we have to enable E-Commerce Tracking in Analytics, and then add a special tracking code to the purchase receipt/invoice page of your shopping cart.

Step 1 – Enabling E-Commerce Tracking

Sign in to your account

Click Edit next to the profile on which you’d like to enable E-Commerce Tracking.

On the Profile Settings page, click Edit next to Main Website Profile Information.

Change the E-Commerce Website radio button from No to Yes.

Step 2 – Adding the E-Commerce Code

Now you need to find your tracking code so you can place it on your receipt/invoice page. Many popular e-commerce platforms do this for you automatically (such as Magento), and many others have modules or plugins available that can be downloaded to find and place this code.

Here are the relevant plugins and guides for the most popular e-commerce systems currently on the web:

OsCommerce: How to setup E-Commerce tracking in Analytics

Zen Cart: Zen Cart Analytics Module

Volusion: Analytics Setup Module

If your online store is not one of those mentioned above, and you can’t find a plugin or module to do take care of installing your E-Commerce Tracking code for you, you’ll have to do it manually. Here’s where the HTML editing comes in.

On your receipt/page you have to add a few lines of JavaScript code:

Important Note: These values are placeholder values, and should be replaced with values from your E-Commerce System. Make sure to change UA-XXXXX-X to your Analytics ID

<head>

<title>Receipt for your clothing purchase from Acme Clothing</title>

<script type="text/javascript">

var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-XXXXX-X']);

_gaq.push(['_trackPageview']);

_gaq.push(['_addTrans',

'1234',           // order ID - required

'Acme Clothing',  // affiliation or store name

'11.99',          // total - required

'1.29',           // tax

'5',              // shipping

'San Jose',       // city

'California',     // state or province

'USA'             // country

]);

There are 3 parts to the E-Commerce Tracking Code. The first part tells Analytics that a transaction has occurred. For this, we set it up so your e-commerce system provides Analytics with a Transaction ID and the total amount:

<head>

<title>Receipt for your clothing purchase from Acme Clothing</title>

<script type="text/javascript">

var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-XXXXX-X']);

_gaq.push(['_trackPageview']);

_gaq.push(['_addTrans',

'1234',           // order ID - required

'',  // affiliation or store name

'11.99',          // total - required

'',           // tax

'',              // shipping

'',       // city

'',     // state or province

''             // country

]);

The next part of the code tells Analytics about each item in the order. This lets us see which keywords drive the sales of which products:

// add item might be called for every item in the shopping cart

// where your ecommerce engine loops through each item in the cart and

// prints out _addItem for each

_gaq.push(['_addItem',

'1234',           // order ID - required

'DD44',           // SKU/code - required

'T-Shirt',        // product name

'Green Medium',   // category or variation

'11.99',          // unit price - required

'1'               // quantity - required

]);

Though there is the option to get really detailed here, we don’t have to tell Analytics everything about each item. The order ID, SKU or product code, price and quantity are enough for Analytics to track the individual products.

Here’s an example of a minimalist tracking code:

_gaq.push(['_addItem',

'1234',           // order ID - required

'DD44',           // SKU/code - required

'',        // product name

'',   // category or variation

'11.99',          // unit price - required

'1'               // quantity - required

]);

The last step is submitting the transaction to Analytics via the line of code below:

_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

When we add all of these parts of the tracking code together, your receipt/invoice page should look something like the following:

<head>

<title>Receipt for your clothing purchase from Acme Clothing</title>

<script type="text/javascript">

var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-XXXXX-X']);

_gaq.push(['_trackPageview']);

_gaq.push(['_addTrans',

'1234',           // order ID - required

'',  // affiliation or store name

'27.98',          // total - required

'',           // tax

'',              // shipping

'',       // city

'',     // state or province

''             // country

]);

_gaq.push(['_addItem',

'1234',           // order ID - required

'DD12',           // SKU/code - required

'',        // product name

'',   // category or variation

'15.99',          // unit price - required

'1'               // quantity - required

]);

_gaq.push(['_addItem',

'1234',           // order ID - required

'DD44',           // SKU/code - required

'T-Shirt',        // product name

'Green Medium',   // category or variation

'11.99',          // unit price - required

'1'               // quantity - required

]);

_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

(function() {

var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

})();

</script>

</head>

<body>

Thank you for your order.  You will receive an email containing all your order details.

</body>

</html>

How to I Assign Dollar Values to My Goals?

Let’s say you don’t have an online store but you do know that each newsletter signup earns you $50. You can assign dollar values to goals like this. When you are setting up your Analytics goals, just set the dollar amount as the goal value as shown in the screenshot below:

 

Entering any numerical value into this box will cause Analytics to allocate a dollar amount to that completed goal.

If you need help on how to setup goals, see this article from Google.

Well that’s all from me this week!

If you’ve got any more burning questions then let me know in the comments and I’ll get back to you with an answer!

 

About

works deep inside E-Web's R & D bunker on top secret and presumably dangerous projects. When he's not being tightlipped about what he's up to, he can be found giving away trade secrets if you buy him a beer.

4 Comments

  1. Josh Reply

    Is there a way to make “Goal Value” the actual order value?

    • Aris Abramian Reply

      Hi Josh

      You can assign a static “Goal Value” to each goal in Analytics, However if the value of each Goal changes with each purchase/conversion then I would suggest using E-Commerce tracking as it will give you a much greater insight than normal goal tracking.

      if you don’t want to do E-Commerce tracking you could create a specific goal for each product and give those static values. Without seeing your website, I’d strongly suggest E-Commerce Tracking.

      Let me know if you need any help with it!

  2. Radu Silaghi Reply

    Thanks for the post, just a quick clarification. If I want to track sales of same sku in different packs at different item price, should I use Product variation field ? Ex. wine sold by Bottle at 15 eur / bottle and by Case of 6 at 10 eur / bottle.

    Would below example be ok for a tranzaction of 61 bottles ?

    Bottle

    sku – ‘1001’

    product name – ‘wine’

    variation – ‘1’

    unit price – ’15’

    quantity – ‘1’

    Case of 6

    sku – ‘1001’

    product name – ‘wine’

    variation – ‘6’

    unit price – ’10’

    quantity – ’60’

    Thanks a lot,

    Cheers,

    • Aris Abramian Reply

      Hi Radu

      To be honest, I’ve never come across that particular situation before, It may be simpler to give that pack its own SKU, and track it that way.

      Let me know if it works as I’d be really interested to see if it does work!

Leave a Reply