In my last post, I wrote about the benefits of using YOURLS, a self-hosted link-shortening service. I’m finding that YOURLS is great, but it’s not perfect. Some of the issues I have experience are part of what you get using most URL shortener services.
Some of the downsides of using link shorteners are:
- Google Analytics doesn’t always capture the original referrer (and I have no clue how they do the rest of the time!).
- When generating links using the bookmarklet (or in this case, also the Yourls installation), there’s no easy way to add campaign, source, medium, content, and term tags for Google Analytics to track.
- Yourls doesn’t allow query strings on URLs by default, making overriding existing campaign tags difficult/impossible. For example:
http://katz.si/t?utm_source=2300
I’m not the only one who wanted these things, so I’ve created a plugin that adds Google Analytics tracking to Yourls. It’s very cool.
Google Analytics Yourls plugin
Download Google Analytics for YOURLS from Github
The plugin features include:
Define default tracking tags
You can define a set of default tags that are added to any link that gets shortened.
utm_source
utm_medium
utm_name
utm_term
utm_content
Override existing tags - you can choose to have your tags replace tags in the long URL that’s being shortened…or not.
Tagging options added directly to the URL form – the best feature in my opinion, you now have an interface to easily add tracking right from the link shortener.
Add query strings to the shortened URL to override or add any tracking tags. This feature has support for abbreviations, too.
If you want to see this in action, check out the links below.
- http://katz.si/t?src=tw expands to
http://www.seodenver.com/yourls-url-shortener/?utm_source=twitter
- http://katz.si/t?med=em expands to
http://www.seodenver.com/yourls-url-shortener/?utm_medium=email
- http://katz.si/t?med=blog&src=seodenver&cam=2300 expands to
http://www.seodenver.com/yourls-url-shortener/?utm_medium=blog&utm_source=seodenver&utm_campaign=2300
Plugin Installation
To install, follow these steps:
- Download the file (updated to correct Github link)
- Upload the
google-analytics
folder into yourusers
>plugins
directory - Go to your YOURLS plugins page
- Hover over Google Analytics, click “Activate”
- Configure the plugin settings by clicking the Google Analytics link in the menu
The post Yourls Google Analytics Link Tagging appeared first on KWS Blog.