Tracking clicks from non-Marketo email sends

💡
Unfortunately, Marketo no longer supports the Munchkin associateLead function so this post is obsolete as of 2021-ish. Kept around for posterity.

The technical heavy lifting behind this post can be found in this earlier post on generating Munchkin Associator Tokens. Read that one first, or bookmark it for later!

A hard truth about using Marketo is that you won't always use Marketo for email. At some point, you'll use MailChimp or SendGrid for one-off sends, or rent your list (with full opt-in of course) to a partner, or use an in-house mail blaster app for special events.

(On the blaster note, shouts to Gammadyne Mailer, possibly the ugliest best-of-breed app ever created, which did the trick quite well in the pre-MA days.)

You can only dodge this question for so long: Is there any way to track clicks on these emails if they're not sent through Marketo? If the addresses are already in your Marketo instance, yes, there are are a few ways, with varying levels of complexity + client-side slickness (the harder you work on the back end, the more streamlined on the end user side).

Now, let's talk about what you will and won't get without sending through Marketo, even if you adopt the powerful technique below:

  • You won't get a literal Clicks Link in Email in the lead's Activity Log, because those activities are only added if you use Marketo's tracking server. However, you will get a Visits Web Page activity logged for the target URL, with (assuming you've added it to the link) utm_medium=email in the query string, which you can interpret in the same way.

  • You won't get clicks attributed to email content unless you take pains to embed some kind of additional identifier, like utm_campaign in your URLs. When email is sent via Marketo, the automatically added ?mkt_tok=… param includes a pointer to the lead for later association and a pointer to the email they received.

  • We'll be partially emulating the mkt_tok by adding lead info to the URL, but you also need email info that you can decode back to one and only one email or you won't get the specificity you'd get with native Marketo sends. With proper parameters added to the query string, you will get everything you care about, including the partner name, Marketo program, and all that good stuff.

Generating the associator token

Reread this for a couple of options for creating tokens.

I'll assume you can export leads from SFDC or Marketo and have a column for MunchkinAssociator. Since it's easiest, I'll be using the prefab token munchkinArgumentsBase64 that's returned from FBMunchkin.getAssociator().

An sample token value is:

WwogICJhc3NvY2lhdGVMZWFkIiwKICB7CiAgICAiRW1haWwiOiAiZW1haWxAZXhhbXBsZS5jb20iCiAgfSwKICAiYjY2NTRlMjQ1OTU4NjBlMmMxYzIzYTE4YjNjODRmM2U1Y2Q1Yzc0NSIKXQ

That's nothing more than the Base64 encoding of this JSON string:

[ "associateLead", {"Email": "email@example.com" }, "b6654e24595860e2c1c23a18b3c84f3e5cd5c745" ]

Which is of course decoded to this simple JS array (carriage returns added):

[
  "associateLead",
  {
    "Email": "email@example.com"
  },
  "b6654e24595860e2c1c23a18b3c84f3e5cd5c745"
]

Having a prepared array means we can smoothly pass it to associateLead later.

(There are other ways to encode and pass the data — a comma-delimited list, whatever — but passing JSON fits most fluently into JavaScript.)

Adding the associator token

Just put the variable after the # in the URL. I'm using {{variable}} double-curly syntax here, but your ESP templates might use %variable% or something else:

<a href="http://example.com/lp.html#{{MunchkinAssociator}}">Click here!</a>

That's all on the sending side.

Reading the associator token

You need one or two simple <script> tags. Make sure they're after the <script> where you already load munchkin.js.

If you don't care about IE9 compatibility, you just need the second inline script and can clip out the conditionally-commented first script.

<!--[if IE 9]>
<script id="atob-ie9-compat" src="https://cdnjs.cloudflare.com/ajax/libs/Base64/1.0.1/base64.min.js">
</script>
<![endif]-->
<script>
Munchkin.munchkinFunction.apply(
  Munchkin, JSON.parse(
    atob( 
      document.location.hash.substring(1)
    )
  )
);
</script>

And so…

With associator tokens in hand and all your links tokenized, you can be assured that non-Marketo emails will be as integrated as possible into your MA pipeline.

While the reporting experience won't be as robust as with an all-Marketo campaign, you'll have a lot to go on. Enjoy!