Send a list of events using connectif.managed.sendEvents

 

Questo articolo è attualmente disponibile in inglese e spagnolo. Puoi fare riferimento a questa documentazione mentre arriva nella tua lingua.

The "connectif.managed.sendEvents" feature is used to send Connectif a list of events, together with the other additional information that may be present on the page. Thanks to this feature, all kinds of events can be reported through JavaScript without the need to implement tags

  

This article is part of the guide to creating a custom integration.
If your integration is via a module, this function will be automatically inserted in your ecommerce platform.

 

How to use it

The "connectif.managed.sendEvents" listing automatically sends the following data:

  

This function can optionally receive an array of "event"-type objects. If no event is indicated, the data from the previous list will be sent to Connectif without any specific event. This can be useful for getting your shopping cart or email back in sync, without the need for a full page reload.

Send information from the "options" object

The function can also optionally receive a "options" object, which can contain any of the following fields:

Name Required Type Description
options.onResponded No function Callback that will be called once the events have been sent to Connectif.
options.cart No object

Indicates the Shopping Cart object to be sent to Connectif (instead of getting the cart from the a "Current shopping cart status" tag).
See more at Report cart information.

options.entityInfo No object

Indicates the object with the Contact information to be sent to Connectif (instead of taking it from the "Contact Information" tag).
See more at Report contact information.

options.pageInfo No object

Indicates the object with the page information that enriches the page visited event (instead of taking it from the page metadata and the "Page Category" tag and "Page Tags").
See more at Report page visited event.

  

After receiving a response from Connectif, the feature will trigger the actions that may have been dictated by the Workflows, such as displaying inline content, a popup, etc.

 

Examples

If not, it will be necessary to wait for the event "connectif.managed.initialized".

Below is an example of how to send events making sure Connectif is initialized:

function trackPageVisit() {
window.connectif.managed.sendEvents([{ type: 'page-visit' }]);
}

if (window.connectif &&
window.connectif.managed &&
window.connectif.managed.isInitialized()) {
trackPageVisit();
} else {
document.addEventListener("connectif.managed.initialized", function onConnectifInitialized() {
trackPageVisit();
},
{ once: true });
}

 

The aspect of the feature can be seen embedded in the various events:

 

 

Congratulations!
You’ve reached the end of the tutorial.

  

Do you have questions?
Don’t forget, our Connectif specialists are here to help you. To contact them, just open a Support ticket by clicking the blue “Help” button on your dashboard.


Keep learning!

To make the most of your Connectif account, we recommend reading these articles next:

Questo articolo ti è stato utile?
Utenti che ritengono sia utile: 1 su 1