SOLVED

Referencing "View as Web Page" in Velocity?

Go to solution
Casey_Grimes
Level 10

Referencing "View as Web Page" in Velocity?

So, I'm looking for some way to retrieve the equivalent of %mkt_webview_url% in Velocity for dynamic scripting. Unfortunately, my educated guess is that the value is only generated once the final email HTML is rendered. Is there any way to get the value ahead of time?

Basically, I'm trying to avoid having to do some wonkiness like {{my.text1}} <a href="{{system.viewAsWebpageLink}}">{{my.text2}}</a> if at all possible.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Referencing "View as Web Page" in Velocity?

Unless something has changed very recently, the value is just the (static) webview path, which is easy to find, plus the mkt_tok. So if you emit a tracked link from Velocity it'll create the fully-formed link.

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Referencing "View as Web Page" in Velocity?

Unless something has changed very recently, the value is just the (static) webview path, which is easy to find, plus the mkt_tok. So if you emit a tracked link from Velocity it'll create the fully-formed link.

Casey_Grimes
Level 10

Re: Referencing "View as Web Page" in Velocity?

That did it and I'm shocked I didn't think to try that instead of overthinking it. Thanks.

Casey_Grimes
Level 10

Re: Referencing "View as Web Page" in Velocity?

Bumping this back up as there is actually a second layer of complexity here.

So, if you run a full Velocity link with "[...]emailWebview?mkt_tok=##MKT_TOK##", the behavior isn't quite the same--it'll pull the correct email, but it won't pull individual-level customization. This is most notably seen with dynamic content, though you also get default token fallbacks (which is less of an issue). I'm guessing something else gets passed when the link is generated (as Steven Vanderberg‌ alludes to in Marketo View as a Webpage Link‌) and I'm a bit stumped as to where to even start working backwards on this one. It seems by the time the URL itself is encoded, that's all handled--there's nothing being passed in the encoded redirect that I can tell.

CC Justin Cooperman‌: is there a way around this one to force Velocity to generate the full equivalent of {{system.viewAsWebpageLink}}?

Casey_Grimes
Level 10

Re: Referencing "View as Web Page" in Velocity?

For posterity:

"After running some tests and discussing this internally with colleagues, it seems that the mkt_tok value generated for view as webpage tokens is slightly different than the mkt_tok value generated for links in emails and Velocity scripts."

So, what was assumed is true. The only real way to approach the issue and to have things render consistently is to do something like {{my.text1}} <a href="{{system.viewAsWebpageLink}}">{{my.text2}}</a>.