Doh... Stinking MS Word email... Formatted better:

Then in your jQuery on load:
// this would be a link to your server side tracking
var trackURL = 'http://www.mywebsite.com/tracking/?trackbyURL=' 
// override the default click event 
$(".advert").click(function(){
        window.location = trackURL + $(this).attr('href');
        return false;
});

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Smith, Allex
Sent: Tuesday, December 11, 2007 12:10 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Using jQuery to track advert clicks



I'm a bit confused as to exactly what you want to do, but try something
like this...

In your html:
<a href="http://www.advertlink.com"; title="Some Ad to an Adverts page"
class="advert">Click me I'm an Advert!</a>

Then in your jQuery on load:
// this would be a link to your server side tracking
var trackURL = 'http://www.mywebsite.com/tracking/?trackbyURL=' 
// override the default click event $(".advert").click(function(){
        window.location = trackURL + $(this).attr('href');
        return false;
});

If they don't have JavaScript enabled your link still works... but you
don't track the click. This is just off the top of my head, so there are
probably better ways. I'm going to assume this is best however for SEO.

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Darren Savery
Sent: Tuesday, December 11, 2007 8:51 AM
To: jQuery (English)
Subject: [jQuery] Using jQuery to track advert clicks


Hi,

Is it possible to use jQuery to track advert clicks? I have adverts that
appear on certain pages of my site. Whenever someone clicks on an
advert, I would like to record this as a new entry in a database table
(tblAdvertClicks).

I know I could pass the visitor to a processing page then forward them
on to the advert destination, but I want the link to do directly from my
site to the advertisers - without a 3rd page being involved (this is for
SEO purposes in case anyone is interested). Someone suggested jQuery
could do this.

Can anyone help?

Reply via email to