Enrich statistical events

⚠️ This feature is available for internal use only

The function axeptio.pushEvent({ type: EVENT_TYPE, correlationId: ID }); is a command used to enrich statistics with an identifier added in correlationId. To understand how to use this function, it is important to understand what each component of the function does.

  • axeptio.pushEvent: This is the main method we use to send an event to Axeptio. In other words, we are telling Axeptio that a certain event has occurred.

  • { type: 'form:submit', correlationId: formId }: This is the event we are sending. It has two parts:

    • type: 'form:submit' : This indicates the type of event that has occurred. In this case, it's the submission of a form.

    • correlationId: formId : This is the unique identifier we associate with this event. This can be used later to retrieve this specific event.

Usage example :

// Suppose we have a form with ID 'myForm'
var myForm = document.getElementById('myForm');

// We are going to generate a unique GUID for this event
var formGuid = generateGUID();

// Now, we are going to add an event listener to our form
// This listener will be triggered when the user submits the form
myForm.addEventListener('submit', function() {
  // When the form is submitted, we send the event to Axeptio
  axeptio.pushEvent({ type: 'form:submit', correlationId: formGuid });

In this example, every time the user submits the form, a new event is sent to Axeptio with a unique identifier. This will allow you to precisely track when and how many times this specific form is submitted.

Last updated