Form submissions tracker - not hermetic

Hi,

We use snowplow javascript tracker to collect form submissions and changes.

We use UTMs in order to know where we got the form submissions from, and it seems that the tracker misses a lot of those form submissions! I know it can’t be hermetic, but it seems to actually miss most of them.

Anyone else encountered in such a problem?

Thanks,
Dor

1 Like

@dor, you need to ensure enableFormTracking is called when the form has been already rendered in DOM.

@ihor
Is there a way to make sure it is loaded after the DOM load?
I thought about 2 options:

  1. use GTM “DOM load” event
  2. place the script above the tag

What do you think?

Thanks,
Dor

@dor, it’s not just DOM load in general but rather the form itself. It really depends on how the form is loaded. If say it is done with an AJAX call at some point in time after DOM of the page has been rendered your approach might still not work.

If you are in control of the form loading process you just need to call enableFormTracking on acknowledge the form has been loaded. If you are not in the control of that process (say, due to 3rd party involved loading the form for you) you might need to implemented your own piece of code checking the presence of the form and then calling enableFormTracking.

Again, to know the answer to your question you need to know how the form is being loaded (inserted) into the page.

Will this function help (let’s take form id be “myForm”)

var formLoadedInterval = setInterval(function()
                             {
                                if($("#myForm").length)
                                {
                                    window.snowplow('enableFormTracking');
                                    clearInterval(formLoadedInterval);
                                },100});

I have come to this discussion because i am myself experiencing this issue a lot. Implementing your idea has reduced the number of failures but still out of 10 form submissions i am getting only 7-8 submissions in my database only. I have no control how the form is being loaded because i am 3rd party.

I have checked logs of requests on my server. In case of failures i can see change_form request but submit_form request is not present though form has been successfully submitted to the server of website where we have deployed our tracking code.If change_form requests are present then window.snowplow(‘enableFormTracking’) function is working fine i guess. Can you help me find the root cause?

@Amandeep_Singh, if you see change_form events already then the problem is somewhere else. The method enableFormTracking “activates” both change_form and submit_form. You might want to go over the tutorial on form tracking: Form tracking with Snowplow [tutorial].

@ihor I have to find it out then. Anyways thanks for the reply.