I'm trying to use tokens in the follow up URL from a form, and I'm having mixed results.
So, for example, I'm trying to redirect the user to a URL:
http://example.com/?foo={{system.munchkinId}}
and from this I'm getting:
http://example.com/?foo=&=&aliId=21#53;32-QQU-051
What appears to be happening is that the value of the token is using HTML escape codes (ampersand encoding), presumably to avoid script injection. Because of the #’s, the majority of the string is being interpreted as a hashtag in the URL (the alild parameter is part of the analytics tracking, as described here).
To make things even more complicated, when I try to use the token in the foliow-up URL in the form itself, the token isn’t even replaced, but when I put it in the follow-up URL on the landing page as I insert the form, the token is replaced and encoded as I have described.
When I use a custom token (e.g. {{my.Example Token}}) the value comes through unencoded (per this question), but unfortunately I need dynamic information that’s only available as either system tokens or lead tokens.
I also experience the same problem when I attempt to to put an HTML block on a landing page that could potentially act as a redirect. Example:
<script type=“text/javascript”>
window.location = “http://example.com/?foo={{system.munchkinId}}”;
</script>
Does anyone have any experience with this? Is there a way to specify if the value of a toke should be encoded?
<script> function update_form_onsuccess() { var form = MktoForms2.getForm(1234); if(!form) { window.setTimeout(update_form_onsuccess, 100); return; } form.onSuccess(function(values, followUpUrl) { if(followUpUrl.indexOf('?') === -1) { window.location = followUpUrl + '?' /* extract needed info from values here */; } else { window.location = followUpUrl + '&' /* extract needed info from values here */; } return false; }); } window.setTimeout(update_form_onsuccess, 100); </script>