SOLVED

Using tokens to display URL based on program/folder name

Go to solution
Justin_Laberge1
Level 4

Using tokens to display URL based on program/folder name

Hi Marketo Community!

I have a problem I'm trying to solve but I'm not sure I'm approaching it in the correct way.

Right now I am working in an instance which has 2 companies using it. They want to have 2 separated unsubscribe centers for both companies and when they send emails from one, the unsubscribe URL should be representative of that company. Building the programs to have the preference centers has been very easy thanks to the community but I'm not sure how to resolve this problem. The database is used between both companies and are tracked through lead stages, thus segmentation would not work as a way to split them.

Is it possible to use something like My Tokens in the unsubscribe text URL to change it based on something such as program name/folder name? The only identifier we use is a 2 letter company name at the start of all programs to identify which company will be sending it. I know how to change the text for the unsubscribe, but I'm not sure if I can make it dynamic for each mail-out.

If I'm completely off base, is there another way I could tackle this issue? Ideally in an automated fashion

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Using tokens to display URL based on program/folder name

How do I include this token in the head of my email?

You can actually put it anywhere you want. It just has to come before your token that sets the URL (since the second token refers to a variable set in the first token).

Definitely don't use a mktoString variable, just put the {{my.companyCode}} directly in the <head> or right after the starting <body>. This token doesn't have any output, it just sets a variable. So it could go even go between two elements:

</div>{{my.companyCode}}</div>

Or just right in front of the second token.

{{my.CompanyCode}}{{my.tokenThatUsesVariablesSetInCompanyCode}}

The sole requirement is that {{my.companyCode}} be used before the second token is used. This may sound confusing, but that's probably because it's simpler than you imagine: tokens are rendered from the top down in an email. Any token can access variables that were set in higher-up tokens.

Documentation is sparse for some of this I find.

Sure is, for multiple reasons:

  • Most Velocity users are developers, not marketers.
  • Most Velocity users are Java developers to boot, so they're writing in a language that's already verbose and relatively difficult to learn.
  • Only a handful of Velocity users are fluent in Marketo.

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Using tokens to display URL based on program/folder name

The database is used between both companies and are tracked through lead stages, thus segmentation would not work as a way to split them.

Actually depends on how you use segmentations.... anyway, you could:

  • Append {{Program.Name}} to the URL (a single URL that serves as a redirector page) and then redirect to the appropriate page based on the first two letters that serve as an identifier.
  • Create a Velocity token at the highest level of Marketing Activities for each company. In that token set the two-letter company name (#set( $companyCode = "AB").  Then use that variable in other tokens (lower down in the hierarchy) to directly append "AB" or "YZ" to the URL.
Justin_Laberge1
Level 4

Re: Using tokens to display URL based on program/folder name

Thanks for these suggestions! Could you provide some more assistance with the Velocity tokens. Is there a resource I could use to find where all the marketo velocity variables are? I think that's a pretty neat solution.

SanfordWhiteman
Level 10 - Community Moderator

Re: Using tokens to display URL based on program/folder name

Thanks for these suggestions! Could you provide some more assistance with the Velocity tokens. Is there a resource I could use to find where all the marketo velocity variables are? I think that's a pretty neat solution.

Marketo includes most of the GenericTools (with the notable exception of LinkTool). But you shouldn't need to do anything complex here. You just want the company code set at the uppermost level in a token like {{my.companyName}}

#set( $companyCode = "AB" )

and then if you include {{my.companyName}} in the <head> of your emails you can have another Velocity token that builds the URLs, like

<a href="http://example.com/unsub?co=${companyCode}">Unsubscribe</a>

I always recommend http://blog.tenkl.com/tag/velocity which is the only place for Marketo-specific Velocity tips, if I do say so...

Justin_Laberge1
Level 4

Re: Using tokens to display URL based on program/folder name

Thanks again for the help, just one more question:


and then if you include {{my.companyName}} in the <head> of your emails you can have another Velocity token that builds the URLs, like

  1. <ahref="http://example.com/unsub?co=${companyCode}">Unsubscribe</a>

How do I include this token in the head of my email?

I currently have - <meta class="mktoString" id="companyCode" mktoname="Company Code" />  but did not figure out how to add the my.companyname token. And you misspelled your blog URL http://blog.teknkl.com/

Documentation is sparse for some of this I find.

SanfordWhiteman
Level 10 - Community Moderator

Re: Using tokens to display URL based on program/folder name

How do I include this token in the head of my email?

You can actually put it anywhere you want. It just has to come before your token that sets the URL (since the second token refers to a variable set in the first token).

Definitely don't use a mktoString variable, just put the {{my.companyCode}} directly in the <head> or right after the starting <body>. This token doesn't have any output, it just sets a variable. So it could go even go between two elements:

</div>{{my.companyCode}}</div>

Or just right in front of the second token.

{{my.CompanyCode}}{{my.tokenThatUsesVariablesSetInCompanyCode}}

The sole requirement is that {{my.companyCode}} be used before the second token is used. This may sound confusing, but that's probably because it's simpler than you imagine: tokens are rendered from the top down in an email. Any token can access variables that were set in higher-up tokens.

Documentation is sparse for some of this I find.

Sure is, for multiple reasons:

  • Most Velocity users are developers, not marketers.
  • Most Velocity users are Java developers to boot, so they're writing in a language that's already verbose and relatively difficult to learn.
  • Only a handful of Velocity users are fluent in Marketo.
Justin_Laberge1
Level 4

Re: Using tokens to display URL based on program/folder name

Thanks so much for your help with this. I learned a lot about the Velocity tokens. I settled on this simple solution:

#set( $url1 = "info.site.com/Unsubscribe-Center_xx.html" )

<a href="http://${url1}?mkt_unsubscribe=1">Unsubscribe</a>

With each company having a unique token and all emails would contain the token and be sent from that folder. This is just beta-testing stage but it was a great learning exercise.