Tracking clicks on banners in a generic way?

J

Jimmy

In the web application I develop, we need to provide the marketing
department with the ability to insert small JavaScript code snippets
into predefined content areas on several pages. This code is supplied
from 3rd parties and may display banners, links and do various other
things. So far so good.

What I need is to track the clicks for each such banner in a generic
way. That is, some javascript or server-side technique that will allow
me to capture and process all the clicks done on this provided JS.
This is like javascript-inside-javascript - you get the idea. Here I
got lost and I'm looking for a solution.

Any ideas?

Thanks a lot for your help!
Jimmy
 
R

Randy Webb

Jimmy said the following on 10/26/2006 7:00 AM:
In the web application I develop, we need to provide the marketing
department with the ability to insert small JavaScript code snippets
into predefined content areas on several pages. This code is supplied
from 3rd parties and may display banners, links and do various other
things. So far so good.

What I need is to track the clicks for each such banner in a generic
way. That is, some javascript or server-side technique that will allow
me to capture and process all the clicks done on this provided JS.
This is like javascript-inside-javascript - you get the idea. Here I
got lost and I'm looking for a solution.

Any ideas?

Lots of ideas. The simplest would be to re-write the snippets so that
rather than pointing at the destination, it points at a file on your
server that would then track the click and issue a Location header to
the actual destination:

<a href="myTrackerFile.php?www.google.com">Google</a>

And then myTrackerFile.php would read the URL, and redirect accordingly
after tracking the click.

Or, another possibility:

<a href="http://www.google.com"
onclick="trackTheClick(this.href)">Google</a>

function trackTheClick(hrefToTrack){
var myImage = new Image();
myImage.src = 'myTrackerFile.php?'+hrefToTrack
}

And then myTrackerFile.php would track the click.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top