What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How to add a tracking javascript code to my form.

    Asked by fwdp on October 08, 2013 at 10:53 AM

    Hi, 

     

    We have been asked by our SEO company to add the below tracking code to the submit button of the form. 

    onClick="_gaq.push(['_trackEvent', 'Newsletter Sign Up', 'Email', 'Cool Grey Link',, false]);" 

    Is this possible? 

    Page URL:
    http://creative.fwdp.co.uk/newsletter-signup.html

    tracking email SEO
  • Profile Image

    Answered by khrisell on October 08, 2013 at 11:36 AM

    Hello,

    For your inquiry, You would need to download the full source code if you want to make any major changes to the way forms work and to be able to add a custom Javascript to your form.

    To download and edit the whole source code of your form.

    1. Click Setup & Embed

     

    2. Click Embed Form


     

    3. Click Source Code

     

    4. Then to Download the whole code by clicking the "here" highlighted word below the code.

     

    From there you can put the custom code you wanted to add to your form.

    If you are having trouble, please let us know so that we could further assist you with it.

    We're here to help.

    Thank you for using JotForm.

  • Profile Image

    Answered by khrisell on October 08, 2013 at 11:50 AM

    In addition to my answer, if this is the complete code you are pertaining to...

    <script type="text/javascript">
      var _gaq = _gaq || [];
      onClick="_gaq.push(['_trackEvent', 'Newsletter Sign Up', 'Email', 'Cool Grey Link',, false]);
      _gaq.push(['_trackPageview']);
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    </script>

     
    Or just the same code (google analytics)
    You can instead use the custom URL Thank-You page feature of your form, and add your Google analytics script there.  This way you can point the people who submitted your form to this Thank-You page and get the statistics of people that made a submission.
    Please clarify, and if you need further assistance please let us know.