The “Purchase event notification” is used to describe a purchase made by the customer. It notifies you, via JavaScript, when a user makes a purchase using connectif.managed.sendEvents.
How to use it
The cart information notification uses the entityInfo option, in the sendEventsmethod, to enrich the information about sent events.
Report the purchase made
This object represents the Shopping Cart model, which includes the following properties:
First name | Required | Type | Description |
---|---|---|---|
purchaseId | Yes | string | Unique purchase identifier. |
cartId | No | string | Unique identifier of the cart from which this purchase originated. |
totalQuantity | Sí | number | Total number of products in the cart (including duplicates). For example: if a cart has three units of one product and seven of another, totalQuantity will equal 10. |
totalPrice | Yes | number | Total amount of the purchase. |
purchaseDate | No | string | Date of purchase. ISO_8601 format is expected. |
products | Yes | Product Basket Item | Items contained in the cart, together with their quantity and the amount. |
Example
The notification will look like this:
connectif.managed.sendEvents([ { "type": "purchase", "purchase": { "cartId": "cart-0098caf9-42f4-44e9-afdd-45eafe892293", "totalQuantity": 1, "totalPrice": 51.88, "products": [{ "name": "My Product", "productDetailUrl": "https://myshop.com/product/details/59a31949a1a562d4979fbca2", "productId": "59a31949a1a562d4979fbca2", "unitPrice": 51.88, "availability": "outofstock", "imageUrl": "https://myshop.com/img/59a31949a1a562d4979fbca2.jpg", "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "priority": 10, "rating": 4, "tags": ["tag1", "tag2", "tag3"], "relatedExternalProductIds": ["59a31953a1a562d4979fbd90", "59a31b2ba1a562d4979fe5b8"], "brand": "Jata", "publishedAt": "2020-05-03T10:15:00Z", "quantity": 1, "price": 51.88 }], "purchaseId": "purchase-e3418b5a-8709-4593-a7c8-d8a7f12df737", "purchaseDate": "2020-06-26T12:52:51.591Z" } }, { "type": "page-visit" }], { entityInfo });
Keep learning!
To make the most of your Connectif account, we recommend reading these articles next:
- Add Connectif JavaScript to your website, insert the code and start collecting information about the visits to your site.
- Integration using tags, 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.