Techniques to Trigger Google Analytics Tracking from PDF Links

1.1k views Asked by At

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

There are 1 answers

2
CrayonViolent On BEST ANSWER

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.