Mobile app version of vmapp.org
Login or Join
Gonzalez347

: Google Analytics lets you manually insert a hit to a URL of your choice with this syntax: (It's intended for tracking links within AJAX applications like GMail) _gaq.push(['_trackPageview', URL]);

@Gonzalez347

Google Analytics lets you manually insert a hit to a URL of your choice with this syntax: (It's intended for tracking links within AJAX applications like GMail)

_gaq.push(['_trackPageview', URL]);


My advice would be to do something like this:

function redirect(url) {
_gaq.push(['_trackPageview', '/outbound/'+url]);
window.location.replace(url);
}

if (country=='IT') {
redirect('http://www.externallink.it/?affiliate=252342');
}
if (country=='ES') {
redirect('http://www.externallink.es/?affiliate=252343');
}
if (country=='FR') {
redirect('http://www.externallink.fr/?affiliate=252344');
}
else {
redirect('http://www.externallink.com/?affiliate=252346');
}


It's actually how outbound link tracking is done in several Analytics integration plugins I've run across.

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Gonzalez347

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme