Custom integration via JavaScript events

JavaScript event integration is the most advanced custom integration option with Connectif and allows greater control over when and how events are sent. It involves sending notifications directly via JavaScript, using the Connectif global object and the functions it offers.

 
To carry out integrations of this type, you’ll need an expert with knowledge of JavaScript, to be able to obtain data from your ecommerce and use the Connectif JS library.

 

How to integrate Connectif using JavaScript events

You can use this integration to configure the sending of information about what happens on your website, however you must complement this method to synchronize your catalog and configure the Web Push.

 

1. Add Connectif JavaScript

Configure the Connectif JavaScript on the web to load on all pages and integrate via events.
 

 

2. Configure sending information via JavaScript events

Initialize and configure the Connectif JavaScript to get all the information:

 

It is recommended, whenever possible, to use managed.sendEvents by grouping all concurrent events into a single send. This allows you to: 
  - Simplify the integration by making fewer calls. 
  - All events are logged in real simultaneous fashion, avoiding tracking inconsistencies. 
  - Reduce, under certain circumstances, the account's activity consumption. 

 

3. Report event submissions 

Configure the events that will notify Connectif of what happens on your website:

 

Sending the visited product event will not sync the product catalog (go to Point 4 to see the options you have for syncing the catalog).

4. Synchronize the product catalog

Product verification does not support sending JavaScript events, as the Connectif product verifier expects to get the "cn_product_visited" tag when visiting the product URL.

You can synchronize your catalog using different methods:

Although product synchronization via Web Scraping is, by default, the easiest to implement, under certain circumstances it may be advisable to switch to another method such as Feed or the API:

  • Feed:
    • Reduces server load by synchronizing the entire catalog in a single call.
    • Reduces the time needed to complete the synchronization of the full catalog.
  • API:
    • Reduces server load as Connectif does not make bulk synchronization calls.
    • Since synchronization is managed on the client side, the frequency is determined by the client.
    • Allows real-time synchronization, product by product or in batch.
    • Allows linking the update timing to eCommerce conditions (campaign launches, offers, etc.), without needing to proceed from the Connectif UI.

 

5. Configure Web Push notifications

To complete the integration you will also need to configure the Service Worker to receive Web Push subscriptions and send notifications to your contacts.
 

 

6. Validate the integration

Once you’ve implemented the sending of information to Connectif, the next step is to confirm that the integration has been carried out correctly.

 

 

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: