UTM check-up bookmarklet for Marketo emails
You must UTM-tag email links in order to get maximum attribution on the web side. But Marketo offers no built-in way to verify the presence of utm_medium
/ utm_campaign
/ etc., so that workflow step is very hard to enforce.
Even if you tokenize heavily and store URLs in {{my.tokens}}, you can't mandate UTMs inside those tokens!
So I wrote a little script you can save as a bookmarklet. The script checks all the links in an email preview to ensure they have at least one utm_
query param.
If you're unfamiliar with a bookmarklet, it's an all-in-one link + script you drag to your bookmarks/favorites bar, so you can click it from on any website.
Drag this button to your bookmarks: UTM Checker 1.0.2
(You can also right-click on it and select “Bookmark Link” or whatever is appropriate for your browser.)
Then, whenever you're in Preview Draft or Preview Email mode, just click the bookmark link you just created. The script loops over your <A>
tags like so (in pseudo-code):
for each link
if link starts with "#" followed by one or more chars, or
link points to View As Web Page server, or
link doesn't start with http:// or https://, or
link has special attribute "data-bypass-utm-checker"
skip to next link
if link is exactly "#"
popup warning message
if link has no query parameters starting with "utm_"
popup warning message
check next link
So say I have my logo linked to my site but forgot to add UTMs:
Then I'll get an appropriate warning:
And while the script ignores links to an in-email #section
(i.e. links to other text blocks within the email itself), it'll warn about links that have only the #
character, since those were probably template placeholders meant to be populated:
You can also force the checker to ignore links by adding a special HTML data- attribute:
<a data-bypass-utm-checker href="http://www.example.com/nope">This link is ignored, even though it doesn't have UTMs</a>
Caveats
- Since HTML (even the cut-down HTML that works in emails) has infinite variety, I can't guarantee that the script will catch every single omission. I will certainly try to fix any false positives — where the script warns you that you've left something out, even though you haven't, and where you feel the
data-bypass-utm-checker
shouldn't be necessary. Let me know in the comments if you see that happening. - Also note the script makes no attempt to correct or improvise UTM tags for you! It simply tells you that you've forgotten them, and also assumes that if you've included only
utm_campaign
that's the only UTM tag you needed. - Some special link types are added to Marketo emails in an already tracked format (already rewritten to bounce off your branding domain, like
http://click.example.com/aaa000bbb111
). Calendar/ICS tokens are added this way, for example. These links can't be accurately inspected (but you shouldn't bother with UTMs on ICS links, anyway). - Non-HTTP links like mailto: and tel: are not inspected. But you're disabling tracking on those links, aren't you?
More stuff
Unminimized JS source is here if you're interested.