Sending the cart to Connectif via AJAX

The AJAX event for products added or removed is used to indicate changes to the cart using AJAX, without the need to reload the page. This way, you can ensure that Connectif is immediately notified when products are added or removed from the shopping cart and optimize the tracking of changes to the cart.


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


How to use it

The AJAX cart event is used to report on a user's shopping cart at a specific time. It notifies you, via JavaScript, when a user accesses a product detail page by using the function connectif.managed.sendEvents, making the following call to Connectif:

connectif.managed.sendEvents([], { cart: cartObject });

This event is an alternative to implementing the cart information notification.


The "cartObject" object has a structure that contains the el "Product Basket Item" object.


Other considerations

It is important to also send the notification when the cart is emptied, so that it does not end up being marked as abandoned.



The notification will look like this (not all data is required):

connectif.managed.sendEvents([], { 
    cart: {
        cartId: '123456789',
        totalQuantity: 1,
        totalPrice: 10.2,
        products: [
                quantity: 1,
                price: 10.2,
                productDetailUrl: '',
                productId: '12345678910',
                name: 'My product',
                description: 'product description',
                imageUrl: '',
                unitPrice: 10.2,
                availability: 'InStock',
                categories: ['/Home'],
                tags: ['tag1','tag2'],
                brand: 'Brand',
                reviewCount: 1,
                rating: 2,
                ratingCount: 2,
                thumbnailUrl: '',
                priority: 20,
                unitPriceOriginal: 10.2,
                unitPriceWithoutVAT: 8,
                discountedAmount: 0,
                discountedPercentage: 0,
                publishedAt: '2020-05-20T15:24:20Z',
                customField1: '',
                customField2: '',
                customField2: ''



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:

Was this article helpful?
0 out of 0 found this helpful