Intro
To track events JavaScript snippet needs to be added to all of your pages.
For detailed information on how to track forms events please refer to guide.
Form Events
Omnisend forms trigger an event named 'omnisendForms' on the window whenever there is an activity on a form. This event is dispatched as shown in the code example below.
const event = new CustomEvent("omnisendForms", {
detail: {
eventName: 'submit',
brandID: 'F12345',
form: {
id: 'F12345',
name: 'F12345',
displayType: 'popup',
versionID: 'F12345',
versionName: 'F12345',
},
formValues: {
emailField: '[email protected]',
phoneNumberCountryCodeField: 'US',
phoneNumberField: '11111111',
firstName: 'Name',
lastName: 'LastName',
// ... any other form value
}
}
});
window.dispatchEvent(event);
Form Event Properties
The type field within the event object can be any of these seven distinct events:
- view - This event fires when a popup, flyout form, or embedded form initially displays on a page.
- interaction - This event fires when the user interacts with the form (e.g., selects the input field) and it will fire only once for each form.
- submit - This event fires upon a visitor completing the primary conversion action in a form (for example, the initial email or SMS subscription) and it will fire only once for each form.
- close - This event fires when a visitor closes a form.
- stepView - This event fires when each step of the multi-step form is displayed on a page, and it can fire multiple times per a form.
- stepInteraction - This event fires when the user interacts in a multi-step form (e.g., selects input field); it fires once per step.
- stepSubmit - This event fires when each step of the multi-step form is submitted, and it can fire multiple times per a form.
Step Events
Step events ('stepView', 'stepInteraction', 'stepSubmit') are fired only with multi-step forms. The 'stepSubmit' event fires whenever a step is submitted and can fire multiple times for the same form. In a multi-step form, the 'submit' event fires only once.
Other Event Details
Aside from the type of event, the event detail object contains the following information:
- brandID - The ID of the brand. This is an alphanumeric code and uniquely identifies each brand in Omnisend.
- step - Step in which the event occurred. Applicable only for the multi-step forms.
- form - Data related to form, including:
- id - The ID of the form. This is an alphanumeric code and uniquely identifies each form in Omnisend.
- name - The name of the form.
- displayType - The display type of the form (e.g., popup, flyout, embedded).
- versionId - This is an alphanumeric code and uniquely identifies each A/B form in Omnisend.
- versionName - The name of the A/B form.
- formValues - This field contains all of the fields and their values submitted to Omnisend:
- emailField
- firstName
- lastName
- phoneNumberCountryCodeField
- phoneNumberField
- … all form`s fields with values