Embedded form not displaying on site

Highlighted
Anonymous
Not applicable

Embedded form not displaying on site

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>

6 REPLIES 6
Highlighted
Level 10 - Community Moderator

Re: Embedded form not displaying on site

Please post a link to your actual page so I can see the console errors.

Highlighted
Anonymous
Not applicable

Re: Embedded form not displaying on site

Thanks Sanford.

Here you go: Axiom Software

I see from the Console that there is this error:

Uncaught SyntaxError: Unexpected token {

Highlighted
Level 10 - Community Moderator

Re: Embedded form not displaying on site

form.onSuccess(function(values,followUpURL){

not

form.onSuccess(values,followUpURL){

Highlighted
Anonymous
Not applicable

Re: Embedded form not displaying on site

Updated, but getting an error now: Uncaught SyntaxError: Unexpected token )

Highlighted
Level 10 - Community Moderator

Re: Embedded form not displaying on site

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!

Highlighted
Anonymous
Not applicable

Re: Embedded form not displaying on site

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.