Cart information notification

The "Cart information notification" event is used to describe the contact’s current shopping cart. It reports on the contact’s current cart via JavaScript, using connectif.managed.sendEvents.

  

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 site automatically.

 

How to use it

The cart information notification uses the entityInfo option,of the sendEvents method, to enrich the information about sent events. This notification describes the entire cart. Connectif is responsible for detecting changes and generating the appropriate events when a product is added or removed from the cart.

  

This notification via JavaScript represents an alternative to implementing the Current shopping cart status" tag in the HTML of your store or website.

Report the shopping cart

This object represents an entire shopping cart at a certain moment in time. It includes the following properties:

First name Required Type Description
cartId Yes string Unique identifier for the cart.
totalQuantity Yes number Total quantity of products in the cart.
totalPrice Yes number Total cart amount.
products Yes Product Basket Item Items contained in the cart, together with their quantity and the amount.

Report products using Product Basket Item

This object represents the products, their quantity and the total price of a shopping cart or purchase.

It includes all the properties of the Product object type (more info in Report visited product event), in addition to the following:

First name Required Type Description
quantity Yes number Number of units of this product.
price Yes number Cumulative price of the products represented by this Product Basket Item. It is usually quantity * unitPrice.

 

Other considerations

It is very important to set a cart identifier ("cartId") and also notify Connectif when the cart is empty, to prevent abandoned cart events from being generated.

 

Example

The notification will look like this:

const cart = {
    cartId: '123456789',
    totalQuantity: 1,
    totalPrice: 10.2,
    products: [{
        quantity: 1,
        price: 10.2,
        productDetailUrl: 'https://mywebsite.com/myproduct-detail-url',
        productId: '12345678910',
        name: 'My product',
        description: 'product description',
        imageUrl: 'https://mywebsite.com/images/myproduct',
        unitPrice: 10.2,
        availability: 'InStock',
        categories: ['/Home'],
        tags: ['tag1','tag2'],
        brand: 'Brand',
        reviewCount: 1,
        rating: 2,
        ratingCount: 2,
        thumbnailUrl: 'https://mywebsite.com/images/thumb/myproduct',
        priority: 20,
        unitPriceOriginal: 10.2,
        unitPriceWithoutVAT: 8,
        discountedAmount: 0,
        discountedPercentage: 0,
        publishedAt: '2020-05-20T15:24:20Z',
        customField1: '',
        customField2: '',
        customField2: ''
    }]
};
connectif.managed.sendEvents([ // here my events if any ], { entityInfo, cart });

 

 

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:

Cet article vous a-t-il été utile ?
Utilisateurs qui ont trouvé cela utile : 0 sur 0