Tracking Vists on another website

WhatsMySize.com is a Clothes Size Calculator which recommends great clothes based on your actually body measurements.  This month I want to track my visitor journey on third party websites to establish how well WhatsMySize.com is doing in finding the right clothes  for our users.

WhatsMySize.com uses Google Analytics and after a heck of a lot of surfing (hence this post) I found an article on the Google Analytics website that might help. To test the article I created a basic html page on another completely different domain (KSLConsultants.com).

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <title>My Page Title</title>
</head>
<body>
  hello...
</body>
</html>

Step 1

Step 1 of the google article isn’t clear, but assuming you have already implemented Google Analytics on your main website and it’s working, simply copy this same tracking code and paste it between the <head> tags on the external page you wish to track.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <title>My Page Title</title>
 <script type="text/javascript">
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
 </script>
 <script type="text/javascript">
  var pageTracker = _gat._getTracker("UA-xxxxxx-x");
  pageTracker._setDomainName("none");
  pageTracker._setAllowLinker(true); 
  pageTracker._trackPageview();
 </script>
</head>
<body>
  hello...
</body>
</html>

Step 2

Simply ask add a few tracking parameters to your normal link to the third party site. So mine is as follows ;

<a href=” http://www.kslconsultants.com/checkouttest/index.html” onclick=”pageTracker._link(this.href); return false;”>Testing Link</a>

But lets face it my nice visitors on whatsmysize are going to wander around the third party website so just link through the page that makes sense on that site and when they get to the page that needs tracking google will work it out.

<a href=" http://www.kslconsultants.com/" onclick="pageTracker._link(this.href); return false;">Testing Link</a>

Step 3

Finally we want to track what money has been spent on the third party site. So lets use the addTrans function as found in the api.

<div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-7680084-1");
pageTracker._trackPageview();
pageTracker._addTrans(
"[order ID]", // order ID - required
"[reference name]", // affiliation or store name
"[order total price]", // total - required
"[vat]", // vat
"[shipping cost]", // shipping
"[customer city]", // city
"[customer state or shire]", // state or province
"[customer country]" // country
);
// the following add item ideally will be called for every item in the shopping cart
pageTracker._addItem(
"[order ID]", // order ID - necessary to associate item with transaction
"[SKU]", // SKU/code - required
"[product name]", // product name
"[description]", // category or variation
"[item price]", // unit price - required
"[quantity]" // quantity - required
);
pageTracker._trackTrans(); //submits transaction to the whatsmysize.com analytics servers
} catch(err) {}
</script>
</script></div>

Test it is working

Once done and a you have clicked through a few times we can check Google is tracking this new page. Open up your Google Analytics account and navigate through to  Top Content and you should see an entry for this page you are tracking. You may have to wait a while (in my case two hours) before Google updates itself.

entry in google analytics

ref

http://www.roirevolution.com/blog/2009/05/stressing_about_your_ga_ecommerce.html

kavitakapoor

Kavita is CEO at What'sMySize. She writes about technology and business. She is mostly based in London. You can contact her directly or via twitter (kavitakapoor)

One thought on “Tracking Vists on another website

Comments are closed.

This site uses biscuits or are they cookies ? explain...

Hello. This site is built in some great software called Wordpress. Out of the box Wordpress uses cookies. These cookies let Kavita figure if it is worth writing some more, as the cookies are used to build the stats page. Cookies also lets you leave messages. If you wish. Not only that cookies make some of the social sharing features work. Gosh it would be super lovely if you used them. There isn't a way to turn off cookies, so sadly you will have to either lump em or leave. Or call Kavita up and get her to read the website to you. Then you can share some afternoon tea, cakes and more importantly, some biscuits. We are telling you so that under EU laws you are all informed. We probably didn't need to tell you as we don't make money on the website. Well you could buy Kavita's book or hire her based on this website and then yes it will be followed up with a request for money, but there isn't adverts or secret nasty click baits hidden in the pages to make us filthy rich or even cover the cost of the server. Anyway we hope this message made you smile. Just a little. You can contact Kavita directly or follow her on twitter.

Close