tags:

views:

26

answers:

1

Hey guys

Basically what I'm looking to do here is to use jQuery and ASP.NET (not really my choice on ASP.NET ) to track links on the page that have a target="_blank" and then have it post to a MSSQL table. We trying to track ads and such on our site that do that and be able to bring up reports on it from those SQL entries.

Any help would be great.

A: 

Well, from the client side you can find all the anchors and forms with "target=_blank" by doing something like this:

var blankies = $('a[target=_blank], form[target=_blank]');

Then you could maybe add new hidden inputs to the forms, and modify the URLs on the <a> tags, if you wanted your server to be able to tell when links are opened to new pages/tabs. Of course, if the URLs go off your site, then you'd have to do something more sophisticated like trigger an Ajax callback upon anchor clicks (or form submits) so that your server would know about it.

You'll have to be careful if the ads are served with their own Javascript, which might alter the tags after the pages are loaded, or include their own handlers (I guess) that your code couldn't really detect.

Pointy