views:

75

answers:

1

Here's the scenario:

I have a mailing list that contains a PDF download link. The PDF contains ads with clickable links. I need to get analytic data on the link clicks - preferably via Google Analytics (due to the richness of information available).

The solution I have in mind is for the link to go to a web page that I host with some sort of ad-specific token. GA records the request and then I use a client-side technique to redirect to the actual target URL. The redirect page serves no purpose other than to track the click and so I'm not worried about it being perceived as cloaking by search engines.

What I want to know is:

  • Are there any alternative ways to achieve the tracking without using an intermediate redirect page (could I perhaps call GA server-side somehow)?
  • If I do use the redirect page approach, what are potential pitfalls could I encounter?

Thanks in advance for any advice.

+1  A: 

dunno what server-side environment/language you use but for instance in php you can use cURL to send an image request to google, with the custom code appended to the url. Easiest way to do it is to output the code with javascript with your custom code and then capture the image request url with a sniffer, so you can replicate the format for your cURL request. Make sure to send header info, including fake browser info so GA doesn't weed it out as a bot. Then forward to the ad url. That way you don't need to output a page.

Yeah you still have a 'redirect' happening but you cut out having to have the client download a page or worry about javascript being disabled, etc...

unfortunately there really isn't anything better you can do.

Crayon Violent
Okay, this looks like what I'm after, but I'm not familiar with PHP. Is this right: A request is made to an image which is intercepted and run through a PHP script. The PHP script calls a GA tracking page via cURL, passing the tracking data in the URL. The cURL request is set to spoof a standard browser request (say, Firefox). After that the PHP performs a 301 to the target URL and the client is none-the-wiser. Does that about sum it up or have I missed something(s)?
Zac
yep, that pretty much sums it up.
Crayon Violent