Hi,
I wonder if anyone can help me. I have a header I use on my site which has a Javascript code for rotating banner ads. I'd like to try to track the clickthroughs on these ads and have been looking at the methods of doing this in google analytics, but they all seem to be for single links, like this: http://www.imavex.com/tracking-clicks-on-ads-with-google-analytics.blog
which then don't work with the links as they are in the banner rather than more standard html links started <a href= etc. I was wondering if anyone knew how I would be able to integrate the analytics code in that link into the banner I have, or of another method I can use to track clicks on the ads.
Thanks! Hope this makes some sense.
This is the banner I'm using:
<script type="text/javascript">function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
}
}
link = new initArray(
"http://www.fitbugs.net/",
"http://www.themeadows.co.uk/events.php?title=Meadows+Toddler+Tuesday+is+Back%21+&eventid=8",
"http://sallyslack.com/",
"http://www.motleyhealth.com/products/low-gi-diet-plan",
"http://www.talkingtots.info/view-class.asp?ID=Southend",
"http://www.barracudas.co.uk",
"http://www.queens-theatre.co.uk/",
"http://www.starreachacademy.com",
"http://www.partywithsid.co.uk",
"http://www.stagecoach.co.uk/chelmsford.html",
"http://www.themeadows.co.uk/news.php?&newsid=33"
);
image = new initArray(
"http://www.essexmums.org/images/fitbugs4.jpg",
"http://www.essexmums.org/images/meadows.jpg",
"http://www.essexmums.org/images/sallyslack.jpg",
"http://www.essexmums.org/images/motleyhealth.gif",
"http://www.essexmums.org/images/talkingtotsbanner.jpg",
"http://www.essexmums.org/images/barracudas.gif",
"http://www.essexmums.org/images/queenstop.jpg",
"http://www.essexmums.org/images/starreach.gif",
"http://www.essexmums.org/images/partywithsid.jpg",
"http://www.essexmums.org/images/stagecoachbanner.jpg",
"http://www.essexmums.org/images/kidsclubbanner.jpg"
);
text = new initArray(
"Fitbugs",
"Meadows Toddler Tuesdays",
"Sally Slack",
"Low GI",
"Talking Tots",
"Barracudas",
"Queens Theatre",
"Star Reach",
"Party with Sid",
"Stagecoach",
"Meadows Kids Club"
);
function getrandom(){
var core2 = Math.floor(Math.random()*11); // amount of items in array
displaybanner(core2)
displaybanner(core2)
}
function displaybanner(theNum2){
var ranlink2 = link[theNum2];
var ranimage2 = image[theNum2];
var rantext2 = text[theNum2];
document.getElementById('theImg2').alt=rantext2;
document.getElementById('theImg2').src=ranimage2;
document.getElementById('theLink2').href=ranlink2;
}
</script><a href="#" target="_blank"
id="theLink2"><img src="" alt=""
id="theImg2" border="0"></a>
<script type="text/javascript">
getrandom();
setInterval("getrandom()", 22000);
</script>