Adrian A.
Adrian A.

Reputation: 172

External click tracking links through img tags

Anyone know a good external link tracking script ? IE. to catch links and referrer stats through a posted img tag, even if there's no actual IMG. I know how PHP works in this matter, but I'd hate to code it from scratch.

Upvotes: 0

Views: 454

Answers (3)

dgw
dgw

Reputation: 530

With Google Analytics you automatically get referrer information, visitor locations, pageviews, and much more. That's probably much easier than coding your own solution. If Google isn't your cup of tea, there are plenty of other solutions.

Add some special setup and you can track outbound links from your own pages as well.

Upvotes: 0

fuxia
fuxia

Reputation: 63576

Just a note: If you create the image file with php, don’t waste your users bandwidth and return a 204 status code (no content) instead of a real image.

Upvotes: 1

Jeffrey Blake
Jeffrey Blake

Reputation: 9709

You can get the referrer via the built-in $_SERVER['HTTP_REFERER'] variable. So use that in the php page that your link/image refers to. Then just have some code on that same php page to stick it where you need it via insertion to a database, or whatever other method you prefer.

Upvotes: 1

Related Questions