Having difficulties in getting this trackable by Marketo. Activity type should be 'Click Email' and not 'Visit Webpage'.
In Velocity Tokens:
Setting Custom Query Strings:
#set($campaign_days_map = {
90 : "?rc=5346&ac=2019&utm_medium=email&utm_source=marketo&utm_campaign=perpetual-wwall-email-renewal-90days",
60 : "?rc=5346&ac=2020&utm_medium=email&utm_source=marketo&utm_campaign=perpetual-wwall-email-renewal-60days",
30 : "?rc=5346&ac=2021&utm_medium=email&utm_source=marketo&utm_campaign=perpetual-wwall-email-renewal-30days",
7 : "?rc=5346&ac=2022&utm_medium=email&utm_source=marketo&utm_campaign=perpetual-wwall-email-renewal-7days",
0 : "?rc=5346&ac=2023&utm_medium=email&utm_source=marketo&utm_campaign=perpetual-wwall-email-renewal-dayzero",
-7 : "?rc=5346&ac=2024&utm_medium=email&utm_source=marketo&utm_campaign=perpetual-wwall-email-renewal-7dayspost",
-14 :"?rc=5346&ac=2025&utm_medium=email&utm_source=marketo&utm_campaign=perpetual-wwall-email-renewal-14dayspost"
})
Grabbing the Custom Object URL value, which is usually https://www.webroot.com/us/en/cart (also have tried without the https://):
#set($custom_query_string = $campaign_days_map.get($campaignDays))
#set($full_url = $TriggerObject.URL + $custom_query_string)
Setting the constructed URL with Custom Query String for the A Tag href value:
#set($anchorLink = '<a href="${full_url}" alias="Renew Now" class="mktoText primary-font button" style="background-color: #f96b07; border-radius: 3px; color: #ffffff; display: inline-block; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; line-height: 46px; text-align: center; text-decoration: none; text-size-adjust: none; width: 100% !important;"><span style="color: #ffffff; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; text-transform: uppercase;">Renew Now</span></a>')
Reference to the set URL + Query String Value in Content created by a separate Velocity Token:
<tbody>
<tr>
<td class="primary-font button" style="-webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px;width: 250px; height: 46px; text-decoration: none;font-weight: 700; font-family: 'Arial', sans-serif; color: #ffffff;font-size: 16px;text-align: center;line-height:13px;" bgcolor="#ff6a13" height="46">
<div class="mktoText">
<!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${full_url}" style="height:65px;v-text-anchor:middle;width:175px;" arcsize="6%" stroke="f" fillcolor="#f96b07">
<w:anchorlock/>
<center>
<![endif]-->
${anchorLink}
<!--[if mso]>
</center>
</v:roundrect>
<![endif]-->
</div>
</td>
</tr>
</tbody>
This creates the Activity Type of 'Visit Webpage', but we are hoping that the link gets wrapped in the Marketo tracking and creates an Activity Type of 'Click Email'.
Any help or assistance would greatly be appreciated, thanks in advance.
The link should be output using the first form from the examples at the bottom of https://developers.marketo.com/email-scripting/
#set($url = "www.example.com/${object.id}")
<a href="http://${url}">Link Text</a>
It''s necessary for the anchor tag be included as a literal up to the //
Without that technique, the link will not be tracked. That's not a Velocity constraint, it's implementation-specific to Marketo's tracked link functionality.
Thanks. I will have to check with our DB Admin to see if they can strip the https:// off of the Custom Object field, but that does work, just tested it.
Thought you said you had tested it above?
Anyway, you also need to change the VML namespace's friendly name like I mentioned above::
#set( $custom_query_string = $campaign_days_map.get($campaignDays) )
#set( $url_no_host = $TriggerObject.URL + $custom_query_string )
#set( $anchorLink = '<a href="https://${url_no_host}" alias="Renew Now" class="mktoText primary-font button" style="background-color: #f96b07; border-radius: 3px; color: #ffffff; display: inline-block; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; line-height: 46px; text-align: center; text-decoration: none; text-size-adjust: none; width: 100% !important;"><span style="color: #ffffff; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; text-transform: uppercase;">Renew Now</span></a>' )
<tbody>
<tr>
<td class="primary-font button" style="-webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px;width: 250px; height: 46px; text-decoration: none;font-weight: 700; font-family: 'Arial', sans-serif; color: #ffffff;font-size: 16px;text-align: center;line-height:13px;" bgcolor="#ff6a13" height="46">
<div class="mktoText">
<!--[if mso]>
<a:roundrect xmlns:a="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="https://${url_no_host}" style="height:65px;v-text-anchor:middle;width:175px;" arcsize="6%" stroke="f" fillcolor="#f96b07">
<w:anchorlock/>
<center>
<![endif]-->
${anchorLink}
<!--[if mso]>
</center>
</a:roundrect>
<![endif]-->
</div>
</td>
</tr>
</tbody>
The code above doesn't generate a tracked link because ${anchorLink} contains the entire tag. Marketo's Velocity scripting will only output a tracked link when the tag itself is literal rather than stored in a variable.
Moving the value assigned to ${anchorLink} on line 3 to line 13 is what's need. Line 13 should be:
<a href="https://${url_no_host}" alias="Renew Now" class="mktoText primary-font button" style="background-color: #f96b07; border-radius: 3px; color: #ffffff; display: inline-block; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; line-height: 46px; text-align: center; text-decoration: none; text-size-adjust: none; width: 100% !important;"><span style="color: #ffffff; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; text-transform: uppercase;">Renew Now</span></a>
and line 3 should be removed.
The code above doesn't generate a tracked link because ${anchorLink} contains the entire tag. Marketo's Velocity scripting will only output a tracked link when the tag itself is literal rather than stored in a variable.
You'll find that the rules are more complex than this.
Here's what I came up with that works currently...pending we can manipulate the URL value.
Set URL value from Custom Object without https://, so now just www.webroot.com/us/en/cart (still have to confirm with others to see if this can be done):
#set($URL = $TriggerObject.URL)
Still setting the Custom Query Strings the same way, but then changed the way full_url is being built to this:
#set($full_url = $URL + $custom_query_string)
Then setting the anchorLink to be used in email token content:
#set($anchorLink = "${full_url}")
In the content for the button:
<tbody>
<tr>
<td class="primary-font button" style="-webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px;width: 250px; height: 46px; text-decoration: none;font-weight: 700; font-family: 'Arial', sans-serif; color: #ffffff;font-size: 16px;text-align: center;line-height:13px;" bgcolor="#ff6a13" height="46">
<div class="mktoText">
<!--[if mso]>
<a:roundrect xmlns:a="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="https://${anchorLink}" style="height:65px;v-text-anchor:middle;width:175px;" arcsize="6%" stroke="f" fillcolor="#f96b07">
<w:anchorlock/>
<center>
<![endif]-->
<a href="https://${anchorLink}" target="_blank" style="background-color: #f96b07; border-radius: 3px; color: #ffffff; display: inline-block; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; line-height: 46px; text-align: center; text-decoration: none; text-size-adjust: none; width: 100% !important;">
<span style="color: #ffffff; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; text-transform: uppercase;">
Renew Now
</span>
</a>
<!--[if mso]>
</center>
</v:roundrect>
<![endif]-->
</div>
</td>
</tr>
</tbody>
In the content for the banner:
<a href="https://${anchorLink}" target="_blank">
<img src="https://mypage.webroot.com/rs/557-FSI-195/images/PERPETUAL-RENEWAL-EMAIL1.png" alt="90 Days to Renew" style="-ms-interpolation-mode: bicubic; outline: none; border-right-width: 0; border-bottom-width: 0; border-left-width: 0; text-decoration: none; border-top-width: 0; display: block; max-width: 100%; line-height: 100%; height: auto; width: 700px;" width="700">
</a>
If you can’t exclude the hostname as the object is written, you can still take the substring(8) and use that.
You don’t actually have to have the <a> inline with the <table>, but it’s obviously fine if you’re comfortable with it.
Don’t forget to change the closing </v:roundrect> to </a:roundrect>,
Just a follow up, but we are deciding to not change the URL field in the Custom Object, so I've gone ahead and used your suggestion and created this:
In the Velocity Script:
#set($anchorLinkCustomObjectStripped = $anchorLinkCustomObject.substring(8))
In the Content:
<a href="https://${anchorLinkCustomObjectStripped}" target="_blank">Some Anchor Text Here</a>
Thanks again for all of your assistance on this!
Great, I'll keep this thread posted. Thanks for the a:roundrect reminder. 😉
That's tested code, Tony.
I must have had a syntax error in that test, I'm assuming...it does seem to be working now. Let me do a few more tests to confirm and also talk with our DB Admin to confirm we can edit that field for the URL before marking this thread as being completed. Thanks.
Before dipping further, are you testing only in Outlook (I am asking because of the VML) or have you tested other clients?
At the moment, only Outlook, but I can run it through GMail here shortly, thanks.
I think Chris tested a Gmail a couple of weeks ago as he thought it might be an outlook issue. And if remember correctly, Gmail failed also. But he's made code changes since then. So, his gmail test might have different results now.
Yes, before I dive deeper into the workaround I want to make sure it isn't Outlook-only, because https://nation.marketo.com/community/product_and_support/blog/2017/03/01/those-bulletproof-buttons-a...
Same result in GMail, no Marketo Tracking.
I'll look at that article on buttons however, thanks Sanford.
OK, I’ll figure this out later as I’m in meetings for a bit.
No worries, thanks and no rush.
I tried a hard-coded version of Custom Object URL value and it worked, but we want to be pulling in that URL field and not hard-coding it.
Here's what I used:
<tbody>
<tr>
<td class="primary-font button" style="-webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px;width: 250px; height: 46px; text-decoration: none;font-weight: 700; font-family: 'Arial', sans-serif; color: #ffffff;font-size: 16px;text-align: center;line-height:13px;" bgcolor="#ff6a13" height="46">
<div class="mktoText">
<a href="https://www.webroot.com/us/en/cart${custom_query_string}${custom_query_string}" target="_blank" style="background-color: #f96b07; border-radius: 3px; color: #ffffff; display: inline-block; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; line-height: 46px; text-align: center; text-decoration: none; text-size-adjust: none; width: 100% !important; color: #ffffff; text-transform: uppercase;">Renew Now</a>
</div>
</td>
</tr>
</tbody>
Yes, I sense you’re going to need a special technique usually used for multiple links, even though you seemingly have only one to output.
Actually, we are outputting the same link for 2 pieces of the email. I've only been isolating this button version, but there's also going to be one on a banner image eventually.