How to add google analytics to your form

Do you know how many users to your form actually finishes and submits the form? Without tracking the success rate, you can’t improve your form for better conversion.
In this post, I will show you how to add Google analytics to your form and how to track the conversion rate.

Simfatic Forms Custom Code Box

The custom code option in Simfatic Forms allows you to put any type of custom code in your form page. This opens many opportunities to customize your form.
To get to the Custom code box, go to the ‘Draw the form’ page. Under the ‘Standard’ tab, there is a ‘Custom code’ button.
custom code box

You can copy and paste the Google analytics tracking code to Form Page Only-> Footer section. (where to get the google analytics code? see here )

google analytics code

analytics pasted

Tracking Goals

Goals allow you to track the number of users who completed the form. When the user has submitted the form, Simfatic Forms displays the “Thank You” page.

“Thank You” page URL

We can track the goal completion using the “Thank you” page URL. One of the easiest way to track goal completion is to use the thank you page URL as the goal completion in Analytics’ goal setting.
You have to have a thank you page where the user is redirected after the form submission.
thankyou page url

Then Use that URL in the Goal setting:
analytics goal setting

goal setting url

Remember you need to have the analytics code in your Thank you page as well.

Generated “Thank You” page

If you are using the generated “Thank You” page, you can track the goal completion here as well. (the second option in Simfatic Forms “Thank you” page step)
thank you generated

In this case, we have to embed a slightly modified version of the analytics code in the “Thank you” page.
Press The editor button and then select the source tab.
In the analytics tracking code, search for _trackPageview and replace the line with updated code:


give any meaningful URL instead of /forms/courseform/thankyou
thankyou page custom code

Save and re-upload the form.

Now, put the same URL in your analytics goal setting.
analytics url setting

Advanced Ecommerce Tracking

Further fine-grained e-commerce tracking is possible through the analytics API (requires some custom Javascript coding See this link for API details ).
In Simfatic Forms, you can get any form element value in the “Thank you” page. For example, if you need the value of calculation field ‘total’, put %total% in the thank you page. You can use those values in the custom tracking code. For example:

    '%_sfm_unique_id_%',           // transaction ID
    'CoursePrep',  // affiliation or store name
    '%total%',          // total
    '0',           // tax
    '0',              // shipping
    '%city%',       // city
    '%state%',     // state or province
    '%country%'             // country