@evaldas, you can call
enableFormTracking again - it is safe to do so multiple times
This will only work for form elements which exist when it is called. If you are creating a form programatically, call
enableFormTrackingagain after adding it to the document to track it. (You can call
enableFormTrackingmultiple times without risk of duplicated events.)
@ihor yes this works for new dynamic forms, but doesn’t work for new fields added to existing forms like when some field is only available after user fills in some text. This is to prevent adding duplicate event listener for submit_form; Ideally you would want to form events and form element events to be handled independently.
I think your suggestion is sensible, it’s not my call whether or not it would be roadmapped/where it would be in the priority list but I think we should track this problem & look into it if the tracker behaves as you describe.
Unfortunately I can’t think of a good workaround for it short of manually instrumenting listeners (which is probably not an easy one), but I’ll mull it over and let you know if I think of something.
@Colm sure thing, I’ll submit an issue a bit later and thanks for the note
Hi I am having difficulty in recalling
enableFormTracking. Can anybody help?
So I have a form which pops up after I click a certain button. I re-enable the form tracking by firing a GTM tag (I am using GTM with snowplow) that calls the enableFormTracking again. Basically I just add script
Unfortunately it does not work. Calling the
window.snowplow('enableFormTracking') from console works though.
Can anybody help or explain about this?
enableFormTracking must be called once the form is visible on the page. This is why calling it a second time in the Console works.
You should configure GTM to only trigger the call to
enableFormTracking once the element is visible in the DOM.
You can safely call
enableFormTracking multiple times, it will only scan forms that it hasn’t seen before on subsequent calls.
Thanks @PaulBoocock, I may have fired the tag which contains script reload at the same time the form loads so there might be timing issue there. Let me try to do script reloads after the form loads and see if it works.