2 Replies Latest reply on Aug 25, 2016 8:20 AM by Kenway Du

    Javascript help: passing through values on form success

    Kenway Du

      Hey guys,

       

      I'm wondering if anyone who knows Javascript (because I know pretty much nothing about Javascript) can help me. I have a landing page that is being used for Google Ads and have been asked what values gets passed through upon form submission.

       

      I've been given this string as an example:
      on_sent_ok: "ga('send', 'event', 'Contact Form', 'submit');"

       

      But I'm not sure how I would even implement this. However, I currently have this block of JS code that executes when the form is submitted:

       

      <script>

      MktoForms2.whenReady(function (form) {

          // Add an onSuccess handler

          form.onSuccess(function(values, followUpUrl) {

              // Get the form's jQuery element and hide it

              form.getFormElem().hide();

              // Grab HTML element and display Thank You message in element

              document.getElementById("thankyou").innerHTML = "<h3>{{my.CTA Follow Up Copy:default=Thanks for subscribing!}}</h3>";

              // Return false to prevent the submission handler from taking the lead to the follow up url

              return false;

          });

      });

      </script>

       

      Is there some way that I could insert that string into this block of code? Again, keep in mind I don't know much about JS. I can only read through it and sort of decipher.

       

      Any help would be appreciated!