Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
UTM Mangler (github.com/huntwelch)
30 points by smacktoward on Jan 16, 2015 | hide | past | favorite | 14 comments


For those unfamiliar with UTM:

Urchin Tracking Module was an analytics package that Google acquired way back when.

UTM defines a set of query parameters that Google Analytics, and other web analytics platforms, use to capture and provide and information about a referring source (or 'channel') to a webpage. At the highest-level, the buckets are direct, organic, referrer, social, email, display, and paid search.

The three UTM parameters that are required to track 'campaigns' in a web analytics tool, such as Google Analytics:, are Utm_Source, Utm_Medium, and Utm_Campaign.

Example: http://stilldrinking.org/utms/utm-mangler.html?utm_medium=so...

If you clicked on the link above, it would inform stilldrinking.org's Google Analytics property that you, the visitor, came from Facebook and are part of the 'jan-15-hn-woop-woop' campaign.


Unfortunately, this won't work for any analytics platform that uses first interaction attribution, which most do. That means, they'll immediately store the first value seen and treat that as the "source" for the visit. Changing it will tweak per visit parameters, but won't really affect most people.

Still cool, but a better solution would be to make a plugin that mangles them before the request is sent :)


Can't speak for other analytics systems, but this is definitely not the case for Google Analytics (which is what most utm_* parameters are targeting).

Google Analytics' default attribution (outside of Multichannel Funnels) is last touch attribution.


GA is definitely ubiquitous, but people serious about attribution aren't limiting themselves to GA :P


Worst of all is when these are used in cache keys especially when some of these get unique values. I did write a simple Nginx set of rules to strip this off when used in the cache key or sending to the backend. Here's a fragment: https://gist.github.com/nikolay/e58fb0de98acd8aed932


Or just strip it entirely:

https://github.com/wistia/fresh-url


This one just removes it after people land on the page, it won't strip attribution which is what it sounds like the OP is going for.

fresh-url is meant to aid site owners so that the users don't see the ugliness of UTM codes :)


Serving garbage is more destructive, I like that!


Awesome logo


What is UTM?


I was expecting something Mapping/GIS related, given [1], but maybe that's just the mental scar-tissue from a previous project involving various data sources that were in formats not quite entirely unlike the ones they purported to actually be. Which meant, along with one incredibly badly designed viewer application, I could legitimately say "I spent almost an hour dragging myself out of the ocean" in a worklog entry :P

[1] https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_...


Back in a previous life I used to work for a software company in the defense/GIS space. It's pretty incredible how much labour goes in to making the earth somehow representable as a series of X, Y and Z tuples. The difference between floating and fixed point could mean being off by dozens of metres.


Stands for "Urchin Tracker Module". E.gs include utm_medium, utm_campaign etc These are query params marketers include in URLs to keep track of which campaigns visitors come from. Most analytics platforms automatically capture these parameters so that they can be analyzed later.


To add to this, utm originates from an analytics software company google acquired some time ago. And they have kept legacy utm prefix ever since.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: