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

    Track the Submit button with Google Analytics

    Asked by davisvision on July 28, 2016 at 05:03 PM

    We are trying to embed a google analytics script into the Submit button action within a form. This form is embedded on our website. 

    Are we missing something?

    Page URL:

  • Profile Image
    JotForm Support

    Answered by Jim_R on July 28, 2016 at 07:19 PM

    Sorry but you won't be able to insert your GA scripts into the form. What you can do as an alternative is to grab the full source code of your form [GUIDE: How-to-get-the-Full-Source-Code-of-your-Form] and implement GA there.

    If your only aim is to track the click event of the Submit Button in GA, the general workflow would be as follows:

    1. Embed your form on your website using the full source code

    2. Locate the Submit button. In your form it would be:

    <button id="input_2" type="submit" class="form-submit-button">Submit</button>

    3. Add an onclick event to your button and place your GA tracking code there:

    <button id="input_2" type="submit" class="form-submit-button" onclick="place your GA logic here">Submit</button>

    Note that you may need to hire a developer to set this up for you.

    On the other hand, there's a rather easier way to track how your form performs by using our native Form Analytics feature. I highly recommend you go to this page http://www.jotform.com/form-analytics/ to learn more about it and give it a spin. Here's how you can access Form Analytics.

    Lastly, we also have a widget for GA https://widgets.jotform.com/widget/google_analytics To add a widget to your form, just follow this guide [GUIDE: How-to-Add-a-Widget-to-your-Form] This only requires you to add your Universal Tracking ID and an optional feature for Cross Domain Auto Linking

    Hope these helped!