In other words: Find out ALL the traffic sources that bring visitors to your website who eventually buy.
Imagine the following scenario: the customer first visited your website by clicking an ad, then visits your website from your newsletter and when he decides to buy he goes to Google, and searches for your site name. By default, Google Analytics considers the referrer of the sale the last source that brought the visitor to your website.
If your Google Analytics eCommerce report attributes many sales to your branding organic searches, the chances are you are loosing a lot of data about the performance of your web marketing efforts.
Understanding the impact of your marketing channels better will help you take better decisions in investing money and resources wisely. SeoMoz has a great article on how to go around it, but I prefer the following 3 step wizard you can use to find out ALL the referrers of your customers before they click the Confirm Order button:
Step 1: Save referrers
Add the following code just after the Google Analytics tracking code. This script will use the Google Analytics cookies to store the referrer of a visitor for each of his visits.
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+";domain="+window.location.hostname+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function googleCookieReferrer()
{
var feed=readCookie("__utmz");
//if the utmcsr is not found, cancel
if(feed.indexOf("utmcsr")==-1) return null;
if(feed!=null){
//new version cookies
if(feed.indexOf("%7C")!=-1){
feed=feed.split("%7C");
feed=feed[0].split("%3D");
}
else
{
//old verion cookie
feed=feed.split("|");
feed=feed[0].split("=");
}
if(feed[1]!=""){
return feed[1];
}
else{
return "";
}
}
else return "";
}
//read the google cookie, and extract the utmcsr parameter from utmz
var referer=googleCookieReferrer();
//if the google cookie was succesfully read, and utmcsr found
if(referer!=null && referer!="") {
//read our cookie, if it exists
if(readCookie("__rfrr"))
{
//cookie data
var feed=readCookie("__rfrr");
//temp cookie string
var feed_temp=feed;
//this will hold the last referer in our cookie
var check="";
//split the data in our cookie.
feed=feed.split("|");
//if its the first element -> string
if(feed[feed.length-1]==null){
check=feed;
}else{
//if multiple elements -> array ->get last
check=feed[feed.length-1];
}
//if last element != referer write cookie, add new referer
if(check!=referer) createCookie("__rfrr",feed_temp+"|"+referer,1000);
} // if no cookie found. Create, and populate
else createCookie("__rfrr",referer,1000);
}
The above code can be adapted by your developers so you can get crazy with it. :)
Step 2: Save data
When the sale happens save the new referral cookie content to your database. You might want to link each customer to his referrers. Ask your programmers to do this operation. Most of the times it’s simply a walk in the park for them to do it.
You could send in the same time the cookie content to Google Analytics as an event but I find it very useful to have it stored on the database. You can use the information much easier in the future for targeting campaigns.
Step 3: Generate reports
Create your own referral reporting area. Here is how your reports could look like:
Just like the reports above, you will have a clear image of the impact of marketing channels on first click, middle click and last click purchases.
Ask you developers to offer you such a report in your website back-end area or simply tell them to send you periodical exports of the data and generate Excel spreadsheet reports. You can go even one step further, and import as well some visitor behavior data though the Google Analytics API to make better use of the reports. Excellent Analytics is a plugin that can help you with that. Start doing some segmentation and most likely you will strike gold.
With the hack in place, you should be able to have a clear image of your marketing channels impact on your website.



Pingback: Are there any free tools for multi attribution conversion tracking? - Quora