SOLVED

How to use my.token in CTA URL

Go to solution
Anonymous
Not applicable

How to use my.token in CTA URL

Hello,

I have a to build a unique url and wire it to CTA in the emails. values that are used to build the URL are in a custom object. I have built a custom token to build the url.

1. Token - my.customURL

#set($myPmtUrl = $!{TriggerObject.paymentConfirmUrl})

#if ((! $myPmtUrl) || ("$!myPmtUrl" == "") || "$myPmtUrl" == "")

  #set($url = "https://beta3.myDomain.com/#login")

#else

  #set($url = "https://beta3.myDomain.com$!{myPmtUrl}")

#end

<p><a href="${url}" style="padding: 10px; width: 150px; display: block; text-decoration: none; border: 0; text-align: center; font-weight: bold; font-size: 14px; font-family: Arial, sans-serif; color: #ffffff; background: #008ed3; -moz-border-radius: 2px; -webkit-border-radius: 2px; border-radius: 2px; line-height: 17px; text-transform: uppercase; letter-spacing: 1px;" class="button_link">LOG IN</a></p>

With this approach I can access the token {{my.customURL}} in the body of the email. renders perfectly well. Problem - This link is not wrapped with Marketo tracking. So it does not show in the reports.  we do not know if the users clicked the links.

2. Token - my.customUrl2

#set($myPmtUrl = $!{TriggerObject.paymentConfirmUrl})

#if ((! $myPmtUrl) || ("$!myPmtUrl" == "") || "$myPmtUrl" == "")

  #set($url = "/#login")

#else

  #set($url = "$!{myPmtUrl}")

#end

${url}

this token return the unique portion of the url. In the Edit link(CTA) portion I have done this.

URL: https://beta3.mydomain.com{{my.customURL2}}

DISPLAY TEXT : LOGIN

[x] Track link

[x] Include mkt_tok

This setup (if works) would be the best.However when I add the token to the URL attribute it doesn't work.  Add Tokens to an Email Link - Marketo Docs - Product Docs  only has lead tokens in the url. I have reviewer other discussions, most them talk about the same. 

Sanford Whiteman​ i saw the discussion about the unique url with leadID Passing unique Marketo id in a survey URL​. How can I create similar with data from custom object ?

Anyone did something similar ? thanks for your help.

-mahesh

1 ACCEPTED SOLUTION

Accepted Solutions
Justin_Cooperm2
Level 10

Re: How to use my.token in CTA URL

Please read this:

http://developers.marketo.com/email-scripting/

You are using email scripting, which is different from normal tokens. In order to make the link tracked, you must follow this pattern:

https://nation.marketo.com/message/121266#111193

View solution in original post

10 REPLIES 10
Will_Thomas
Level 3

Re: How to use my.token in CTA URL

You might be able to run a campaign within your program that will map the my.token onto a lead field, then use the lead field in the URL.  If the my.CustomURLs are being built correctly this might solve your problem.

Anonymous
Not applicable

Re: How to use my.token in CTA URL

William - we don't want to add any more custom fields to lead. Thanks though.

Justin_Cooperm2
Level 10

Re: How to use my.token in CTA URL

Please read this:

http://developers.marketo.com/email-scripting/

You are using email scripting, which is different from normal tokens. In order to make the link tracked, you must follow this pattern:

https://nation.marketo.com/message/121266#111193

Justin_Cooperm2
Level 10

Re: How to use my.token in CTA URL

See my comment toward the bottom of that thread...

Anonymous
Not applicable

Re: How to use my.token in CTA URL

Anonymous
Not applicable

Re: How to use my.token in CTA URL

Justin Cooperman​ ,

Does the functionality vary by the email editor version ? In out sandbox we have email 1.0 above mentioned solution works well. Production instance has email 2.0 and it does not work there. Other URL's are also not wrapped with mkto_tok . Any idea why this happens ?

Thanks

Mahesh

SanfordWhiteman
Level 10 - Community Moderator

Re: How to use my.token in CTA URL

This is a really weird construction:

#if ((! $myPmtUrl) || ("$!myPmtUrl" == "") || "$myPmtUrl" == "")

You already set $myPmtUrl to an empty or non-empty string, so you don't need to silence it.  All you need is

#if( $myPmtUrl.isEmpty() )

Anonymous
Not applicable

Re: How to use my.token in CTA URL

Sanford Whiteman​,

I like the simplicity of the code, however it did not work on my production instance. Also not wrapped with marketo tracking code, very strange.

Here is the full script.

#set($myPmtUrl = $!{TriggerObject.paymentConfirmUrl})

#set($address = "MyDomain.com")

###if( $myPmtUrl.isEmpty() )  ## Did not work!

#if ((! $myPmtUrl) || ("$!myPmtUrl" == "") || "$myPmtUrl" == "") 

  #set($url = "$address/#login")

#else

    #set($url = "$address$myPmtUrl")

#end

#set($bodytext = '<p><a href="https://${url}" style="padding: 10px; width: 150px; display: block; text-decoration: none; border: 0; text-align: center; font-weight: bold; font-size: 14px; font-family: Arial, sans-serif; color: #ffffff; background: #008ed3; -moz-border-radius: 2px; -webkit-border-radius: 2px; border-radius: 2px; line-height: 17px; text-transform: uppercase; letter-spacing: 1px;" class="button_link">LOG IN</a></p>')

${bodytext}

Justin_Cooperm2
Level 10

Re: How to use my.token in CTA URL

Re-read the link I posted above.

You'll want something like:

#set ( $mylink = "www.marketo.com" )

<a href="http://${mylink}">Click Here!</a>

So, in your example, just put this instead of assigning it to bodytext:

<p><a href="https://${url}" style="padding: 10px; width: 150px; display: block; text-decoration: none; border: 0; text-align: center; font-weight: bold; font-size: 14px; font-family: Arial, sans-serif; color: #ffffff; background: #008ed3; -moz-border-radius: 2px; -webkit-border-radius: 2px; border-radius: 2px; line-height: 17px; text-transform: uppercase; letter-spacing: 1px;" class="button_link">LOG IN</a></p>