An URL Shortener is a service that takes long URLs and squeezes them into fewer characters to make a link easier to share, tweet, or email to friends. Using a shortened URL leaves more room to say what’s on your mind.
Goo.gl allows you to track, in real-time, the clicks and referrers on any shortened URL - a perfect tool to help you understand what appeals to your audience and to help you optimize your social, email, and other click-through campaigns. This service offers you these benefits:
- Stability: reliable service with good uptime.
- Security: warning message if the short URL points to a suspected malware, phishing, or spam website.
- Speed: fast resolution of short URLs (in a few milliseconds).
- Analytics: track the number of clicks on your link.
- Immutable: once created by you, no one can change them.
- Irrevocable: once created, they do not expire. Note, however, that Google reserves the right to remove any shortened URL, for example for spam, security or legal reasons.
The Google URL Shortener provides analytics tracking for all short URLs, to access your short URL’s analytics, just add
.info after any short URL, for example
http://goo.gl/Crj7U.info. This service currently reports short URL click analytics across various categories. The different analytics categories currently available include the raw click counts, and their distribution across referrers, browsers, platforms, and geographical locations. Additionally, you can slice this data across different time periods.
After a little research I could find a way in which I could trick the track for the analytics systems of the Google URL Shortener service, basically the tracker register each Request to each short URL before redirect the Request to the real URL, to get the statistics this service use the
User_Agent present on each HTTP Header to get the necessary information.
I found two ways (one easiest that other) to trick these Requests, the first method consist in the creation of a Virtual Host in a local web-server pointing to an URL like
www.cixtor.com configured in the file
/etc/hosts and identified by a local IP address like
127.0.3.4; using a local folder with a simple HTML file with a link to the short URL you can trick the Google URL Shortener tracker to think the link is placed in the real host accessed before (
www.cixtor.com in this case).
But that is a complicated way to do that simple thing, because all of that can be done using CURL, and this is how I could do it, basically two parameters available for this tool (through command-line), first the
--referer representing the Host/URL where was originated the Request, and second the
--user-agent indicating the type of browser and operating systems used to send the Request; so here is an example.
$ curl \ --referer 'www.google.com' \ --user-agent 'Mozilla/5.0 (X11; Linux x86_64) Chrome/26.0.1410.63' \ --head 'http://goo.gl/Crj7U'