Google Analytics reporting for multilingual e-commerce stores – Part 1
March 5th, 2010 | Published in Google Analytics, Google Conversions
If your business operates in many countries and across many different languages, you will more than likely want to be able to report on the performance of each region and or language separately. You may also want to report on all regions in aggregate (often referred to as roll up reporting).
We'd like to take a look at e-commerce websites and ways to structure them to report on activity in multiple regions and languages, so over the next week, we'd like to share a series of posts showing you three different ways to achieve a similar reporting effect. These three different methods are not an exhaustive list of possible configuration options, rather they should serve as a guideline to different possible structures that you can adapt to meet your own reporting needs.
We'd like to take a look at e-commerce websites and ways to structure them to report on activity in multiple regions and languages, so over the next week, we'd like to share a series of posts showing you three different ways to achieve a similar reporting effect. These three different methods are not an exhaustive list of possible configuration options, rather they should serve as a guideline to different possible structures that you can adapt to meet your own reporting needs.
Today we'd like to share the first of three potential methods to do this.
Method 1: Multiple languages on a single domain
This set up assumes you have a website with a single domain, where each language version is available under the same domain.
It also assumes you process payments on your own domain (e.g. you have your own secure certificate for credit card payments). Example, if you have a 'thank you' page it may look like: http://www.example.com/thank-you
Google Analytics e-commerce tracking code:
If you want to be able to determine which language version is responsible for a sale, you could use the affiliation field to associate a transaction with a particular language.
Here is an excerpt of the Google Analytics e-commerce _addTrans() method that would appear on your thank-you page.
var pageTracker = _gat._getTracker('UA-12345-1');
pageTracker._trackPageview();
pageTracker._addTrans(
'1234', // order ID - required
'ES', // affiliation or store name
'28.28', // total - required
'1.29', // tax
'15.00', // shipping
'San Jose', // city
'California', // state or province
'USA' // country
);
pageTracker._trackPageview();
pageTracker._addTrans(
'1234', // order ID - required
'ES', // affiliation or store name
'28.28', // total - required
'1.29', // tax
'15.00', // shipping
'San Jose', // city
'California', // state or province
'USA' // country
);
The affiliation field above has been highlighted. In this instance the ES represents the Spanish language version of our site as being responsible for the transaction.
Populating the Affiliation Field:
Option 1
Many multilingual sites often save visitor language preference in a cookie. If this applies to you, simply read the preference in the visitor's cookie and populate the field using some custom javascript.
The W3schools website provides an example of how to read a cookie value using javascript.
Assuming our cookie is called language and it contains a value such as es
//This function will return the value stored in a cookie
//It accepts the argument of cookie name
function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}
//Store the value of our language cookie in the variable visitorLang
var visitorLang = getCookie('language');
var pageTracker = _gat._getTracker('UA-12345-1');
pageTracker._trackPageview();
pageTracker._addTrans(
'1234', // order ID - required
visitorLang, // Affiliation field (language preference of visitor)
'28.28', // total - required
'1.29', // tax
'15.00', // shipping
'San Jose', // city
'California', // state or province
'USA' // country
);
Option 2
Depending on your shopping cart system, you may have a server side variable you can access to populate this parameter.
How do I access the store information in Google Analytics?
The affiliation field is available in both Advanced Segmentation and Custom Reports. Below is an example of a Custom Report using the dimension "Affiliation".
You can of course mix your own valid metrics and dimensions to suit your reporting needs. The report will look something like this:
Note: Please keep in mind if different language versions of your site use different currencies each Google Analytics profile can only be set to 1 currency type.
For example if you sell items to French visitors in Euro's, but you also sell to Danish visitors in Krone. You will need to convert all transaction values to a single base currency.
Google Analytics does not provide any currency conversion facility. Instead it will just prefix the monetary value displayed in reports with the appropriate currency symbol.
In our next post, we'll discuss a second method to achieve a similar reporting outcome.