Has anybody ran into an issue where, after editing the standard embed code to include an onSuccess push of an event to Google, the form disappears? Below is the updated embed code I was trying to use. I'm not a develop by any means, but it seems to match the syntax I've seen in other discussions in the community. Thanks for looking!
<script src="//app-sj04.marketo.com/js/forms2/js/forms2.min.js"></script>
<formid="mktoForm_XXX"></form>
<script>
MktoForms2.loadForm(("//app-sj04.marketo.com", "XXX-XXX-XXX", XXXX, function(form){
form.onSuccess(values, followUpURL){
dataLayer.push({event: 'EVENT NAME'});
return true;
});
});
</script>
Please post a link to your actual page so I can see the console errors.
Thanks Sanford.
Here you go: Axiom Software
I see from the Console that there is this error:
Uncaught SyntaxError: Unexpected token {
form.onSuccess(function(values,followUpURL){
not
form.onSuccess(values,followUpURL){
Updated, but getting an error now: Uncaught SyntaxError: Unexpected token )
Actually, you added another comma. You want this:
MktoForms2.loadForm("//app-sj04.marketo.com", "654-CNY-224", 4143, function(form){
form.onSuccess(function(values,followUpURL){
dataLayer.push({ event: 'Banking Analytics'});
return true;
});
});
However, I do not endorse this code because you will lose hits. I'm only telling you how to avoid syntax errors!
That cleared up the errors in the console, but it still isn't visible. I'm wondering if it has to do with how the page was coded via our CMS.