How to add form tracking events for Impressions, Submissions, and Closings

Collect additional information about user behavior on the site with a subscription form using events.

You can track the following events:

  • Showing the form to the visitor
  • Form submission
  • Closing a pop-up form (if you have selected a "popup-window", "floating" or "fixed" form)

When form events are triggered you can implement additional scenarios: display an additional block of text, redirect users to another page, send data to your analytics system, and so on.

Add a script that will be triggered by the selected event before the closing tag </body> to the page with the form.

Code example to track Show Form event:

document.addEventListener ("spFormShowEvent", function (e) {
console.info ("Event is:", e);
console.info ("Custom data is:", e.detail);
});

Code example to track Submit Form event:

document.addEventListener ("spFormSubmitEvent", function (e) {
console.info ("Event is:", e);
console.info ("Custom data is:", e.detail);
});

Code example to track Close Form event:

document.addEventListener ("spFormCloseEvent", function (e) {
console.info ("Event is:", e);
console.info ("Custom data is:", e.detail);
});

You can add all three events or just one.

With the event you receive not only the event notification itself, but also the Form ID that triggered the event.

    Rate this article about "How to add form tracking events for Impressions, Submissions, and Closings"

    User Rating: 4 / 5

    Previous

    How to transfer UTM tags from subscription forms to a mailing list

    Next

    How to create a simple subscription form

    Popular in Our Blog

    Try SendPulse today for free