We work with an affiliate program where you need to use different affiliate links for some specific countries. Because of that our links in the content are pointed to an internal page http://www.oursite.com/affiliateprogram where we do a javascript redirect based on geo IP (we use maxmind javascript service to detecct the country code: http://j.maxmind.com/app/country.js ). We also have a 5 second meta refresh to the main affiliate link in case the country code detection fails.
This is the meta tag:
<meta http-equiv="refresh" content="5;url=http://www.externallink.com?affiliate=252346">
and this is part of the javascript redirection:
if (country=='IT') {
window.location.replace('http://www.externallink.it/?affiliate=252342');
}
if (country=='ES') {
window.location.replace('http://www.externallink.es/?affiliate=252343');
}
if (country=='FR') {
window.location.replace('http://www.externallink.fr/?affiliate=252344');
}
else {
window.location.replace('http://www.externallink.com/?affiliate=252346');
}
The question is; how can we track the visits of each outbound link using Google Analytics?