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.
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.
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 });
Keep learning!
To make the most of your Connectif account, we recommend reading these articles next:
- Add Connectif JavaScript to your website, to insert the code and start collecting information about visits to your page.
- Tag integration, to discover all the notifications you can send from your ecommerce to Connectif and how they work.
- Integration with Connectif via API, to synchronize contacts, products, purchases and vouchers.
- Check the integration with your ecommerce, so you can be confident that your data is syncing correctly with your Connectif account.