Is it possible to append a URL parameter after successful marketo form submissions? Example. 'www.example.com/thank-you-for-a-demo/?status=
Of course!
MktoForms2.whenReady(function(mktoForm) {
form.onSuccess(function(submittedValues,thankYouURL) {
var rewrittenTYLoc = document.createElement("a");
rewrittenTYLoc.href = thankYouURL;
rewrittenTYLoc.search += "&" +
encodeURIComponent("additionalParamName") + "=" +
encodeURIComponent("additionalParamValue");
document.location = rewrittenTyLoc;
return false;
});
});
Thanks Sanford!
Quick question:
Where in the code of the form would I insert this? I tried adding at the beginning and I was not able to append the url after form submission.
Also - is there anywhere in the code where I will need to add "=success" so that after every form submission, the url will be appended with this?
Thank you so so much!
You'd add it in its own <script> tag. With the form embed, put it anywhere after the embed code. On a Marketo LP, just before the closing </body> tag.
additionalParamName and additionalParamValue can be replaced with whatever name/value you want.