P: 1300 853 868 / 07 3056 0665
Mobile/Tablet Apps | Websites | Applications

Wednesday, July 5, 2017

Short URLs and Click Tracking on a Budget

We often have a need to provide a URL to someone and want to see if it gets used ... and if it's a public link then it'd be nice to see how often (and when) it has been used.

Sure, there are ways to do that but they can be a bit difficult and especially so if the URL doesn't belong to us (i.e. we can't access analytics / site statistics for the target URL).

There are URL shorteners out there that either work automatically (YouTube, Twitter etc use their own when you create content), or that you can use yourself (bit.ly, for example). In bit.ly's case you can also access some basic click-through information to see how popular your link has been at any given moment.

Google Analytics from our Link Shortener service (back-end reporting)

But, we all know and love Google Analytics because it's free and the analytical/graphing side of things are quite mature so you can create a complex set of analysis tools without the need to move to something like Google Analytics 360 (the insanely expensive, but equally insanely powerful Enterprise version of Google Analytics).

So we thought we'd fix the problem of bridging the gap between a URL shortener and Google Analytics.

And a couple of hours of internal "code challenge" later we have a brand new service that we are already using ourselves to create and track link usage throughout our own network of web properties.

It's called CI Link Us (https://cilnk.us) and you'll see that each of the URL's we have linked to in this blog post already run through the service - so we can see when someone has clicked a link.

Currently, we are only sending basic metrics to Google Analytics ... the shortened URL and the target URL ... and that's mostly all we need because Google Analytics will add the location info by way of the referring IP address and we can create drill-down reports based on time-of-day etc.


How did we do it ?


We actually used a server-side PHP script class to do the work for us ... so instead of Javascript in a user's browser talking to Google Analytics (which would be impossible because the shortener site immediately redirects to the target URL), we do that talking in the background (server to server) and flick the user to their desired URL.

Easy!


Want to try it ?


What's stopping you ?  .... Go for it.