Appending Tokens to a URL without Losing Tracking

Anonymous
Not applicable

On certain occasions you may wish to append information to a URL in Marketo. This is often the case when you’re appending parameters for the purposes of tracking in analytics tool.

Whenever you are adding parameters that include lead or program tokens, you need to make sure to do this properly so you do not mess with your ability to track link clicks in Marketo.

If the parameters are fixed (meaning the same for everyone in the program), you can do this with a program token. But you do not always get the same results.

Here’s the tokens I set up to test adding program tokens:

And here are the combinations of these tokens that I inserted into my emails:

<p><a href="http://{{my.Website URL}}">Full URL</a></p>

<p><a href="http://www.marketo.com{{my.URLParameters}}">Parameters Only</a></p>

<p><a href="http://{{my.BaseURL}}{{my.URLParameters}}">Base + Parameters</a></p>

<p><a href="{{my.BaseURLwithHTTP}}">Base with HTTP</a></p>

<p><a href="{{my.BaseURLwithHTTP}}{{my.URLParameters}}">Base with HTTP + Parameters</a></p>

The first three resolve to this:

https://www.marketo.com/?utm_campaign=FB&utm_term=LI&utm_source=1166&utm_medium=email&mkt_tok=3RkMMJ...

The fourth one resolves to this:

https://www.marketo.com/?mkt_tok=3RkMMJWWfF9wsRomrfCcI63Em2iQPJWpsrB0B%252FDC18kX3RUvIbSffkz6htBZF5s...

The last one resolves to this:

https://www.marketo.com/?utm_campaign=FB&utm_term=LI&utm_source=1166&utm_medium=email

You will notice that in this last set up the mkt_tok that allows us to track email link clicks is not appended to the URL in this case. Basically, what this means is that if you are adding multiple tokens into the URL, you need to ensure the HTTP is pulled out of the text tokens and is added directly into the HTML code.

Now, let’s imagine that we want to add in program tokens as well as lead tokens. Perhaps we want to include the person’s lead ID somewhere in the URL.

Here's the token I inserted into my email:

<p><a href="http://{{my.WebsiteURLwithLead}}{{lead.Id}}">with Lead ID</a></p>

This link resolves to (note the lead ID in yellow):

https://www.marketo.com/?utm_campaign=FB&utm_term=LI&utm_source=1166&utm_medium=email&id=1000092&mkt_tok=3RkMMJWWfF9wsRomrfCcI63Em2iQPJWpsrB0B%252FDC18kX3RUvIbSffkz6htBZF5s8TM3DUlpEXrVX7UELSbQ%253D

What if I want to add two non-program tokens into my URL? Well, aren’t you getting fancy.

<p><a href="http://{{my.BaseURL}}{{my.URLtoIndustry}}{{company.Industry}}&amp;utm_source=1166&amp;utm_medium=email&amp;id={{lead.Id}}">with Industry and Lead ID not all Tokens</a></p>

This link resolves to:

https://www.marketo.com/?utm_campaign=FB&utm_term=Banking&utm_source=1166&utm_medium=email&id=102364...

What if I change the format and put all of the extra information into program tokens?

<p><a href="http://{{my.BaseURL}}{{my.URLtoIndustry}}{{company.Industry}}{{my.URLafterIndustry}}{{lead.Id}}">with Industry and Lead ID</a></p>

This link resolves to:

https://www.marketo.com/?utm_campaign=FB&utm_term=Banking&utm_source=1166&utm_medium=email&id=102364...

As you can see, you get identical results.

Summary

As long as you have the http:// pulled outside of the text token, you can append program and lead/company tokens to URLs (and yes to append system tokens also). Note that this is not how email script tokens will work, but that’s a topic for another time.

1372
3
3 Comments
Level 10 - Community Moderator

Thanks for this, Kristen.  But I find the examples incomplete because they don't reflect the click tracking host (branding domain).  It's the visit to that host, and not the presence of the mkt_tok query param, that tracks email link clicks.  Without mkt_tok, you can't associate the Munchkin session that directly follows the link click (after the tracking host redirects to the destination URL).  The link click itself will still be logged. 

What I think most people are curious about is when tracking -- the rewrite via the branding domain -- is quietly disabled because of the way the initial link is constructed, whether tokens do or don't include the protocol, etc.

Anonymous
Not applicable

Thanks; that'll be a good follow up topic!

Anonymous
Not applicable

Thanks Kristen. Never thought about using a token as a parameter. Creative!