Appending Tokens to a URL without Losing Tracking

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="{{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:

The fourth one resolves to this:

The last one resolves to this:

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):

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:

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:

As you can see, you get identical results.


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.