2 Replies Latest reply on Aug 24, 2018 10:03 AM by Grégoire Michel

    Hosting Marketo Form code in an external file

    Grégoire Michel

      In order to deal with a especially complex web site project, we are looking into the possibility to host the Mkto form code in an external file, instead of adding the embed code in the web page.

       

      Typically, the page will a contain a very short code:

       

      <script src2="//info.domain.com/js/forms2/js/forms2.min.js" type="text/javascript"></script>
      <form id="mktoForm_9999"></form>
      <script>
      var mktoFormID = 9999,
          mktoMunchkinID = "999-XXX-999",
          mktoDomain = "//info.domain.com";
      </script>
      <script src2="//info.domain.com/rs/999-XXX-999/images/ExternalEmbedCode.js" type="text/javascript"></script>
      
      
      
      

       

      (I replaced scr with src2 in the <script> tags as the community editor removes the src from the <script> tags.)

       

      Where ExternalEmbedCode.js contains all the form customized load code, starting with:

       

      MktoForms2.loadForm(mktoDomain, mktoMunchkinID, mktoFormID, function(form) {...
      

       

      The first tests seems to be working correctly.

       

      Has anyone done such things? Any performance issue ? Any other thing to pay attention to ?

       

      Thx for your help.

      -Greg

       

      Sanford Whiteman