I've published a small e-book in PDF format, which contains several embedded links to external URLs. I want to measure the clicks users make from that offline PDF to those external URL destinations. NOTE: these outbound links will NOT be outbound from my website, but rather from the offline PDF.

GA Events is the typical way to track outbound links from a webpage, but how to execute this when the link instead originates in an offline PDF?

I tried sending each link from the PDF to a unique (but non-existent) URL on my own website domain, with a corresponding htaccess 301 redirect to the correct external URL. This functioned seamlessly for the user, but failed to track because a pageview never actually occurred on my site ...

Any suggestions?

  • 1
    Do you need to use GA? Can you add a query string to the URLs and track this in the destination site?
    – MrWhite
    Dec 25, 2014 at 18:32
  • Thanks, but the destinations are sites which I do not control (helpful resources, vendors, etc.), so I cannot install GA on them. But I'd still like to know how many clicks I'm sending to them. Dec 25, 2014 at 18:35
  • I don't know a better solution... I would do something like you have already tried via a unique url on your own site and implement your owning tracking script. Or use something like bit.ly, which has its own tracking.
    – MrWhite
    Dec 25, 2014 at 19:06
  • @w3d, thanks for the help. It indeed looks like bit.ly offers some very robust solutions for this and more. But at $995/mo ... will probably look at another alternative. Dec 26, 2014 at 1:09

2 Answers 2


Instead of installing a database, as you already have the redirect setup, you should be able to collect the access logs on your HTTP server(s) (guessing Apache if you're using .htaccess?) and use any number of packages to analyze it. Things ranging from the free AWStats to (often paid) Splunk.

Of course this assumes you at least have access to the access log or are able to configure your server to produce one. (Some shared hosting providers may not give this to you)


To track clicks you could create a database which records the clicks. So something like what you have already done via unique url on your site. For each link create a row with link url (to redirect to) and click_id to know which to update.

example.com/track.php?click_id=2 redirects to google.com
example.com/track.php?click_id=2 redirects to yahoo.com

Once landed on example.com, track.php a script will update the database where click_id = 2 (increment) and then redirect.

There are loads of scripts available to do this for free heres some I found for you, havent tested with but looks like it'll do the job. The second has a live demo. Hopefully that helps.

http://www.phpdevtips.com/2011/07/simple-advanced-click-tracking-using-php-and-mysql/ http://www.phpjunkyard.com/php-click-counter.php

  • those certainly look like what I need! I've never utilized something like that; where does one install the script? Somewhere on my webhost directory? Will follow the tutorial and see if I can execute it. Thanks! Dec 26, 2014 at 1:11
  • No probs, you can install it in any directory of your server. Why not try it out locally first? Btw, if this solves your problem you can accept the it as the answer. Good luck!
    – Abu Nooh
    Dec 26, 2014 at 2:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.