Purchase event notification

 

Questo articolo è attualmente disponibile in inglese e spagnolo. Puoi fare riferimento a questa documentazione mentre arriva nella tua lingua.

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.

  

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 cart information notification uses the entityInfo option, in the sendEventsmethod, to enrich the information about sent events.

  

This event is an alternative to implementing the "Purchase made" tag in your store or website’s HTML.

 

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

Although optional, the cartID field is highly recommended in order to mark the cart as purchased and avoid incorrect Abandoned Cart events.

 

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 });
  

Normally, the purchase will be reported with the page visit event. This usually represents a visit to the order or purchase confirmation page.

 

 

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:

Questo articolo ti è stato utile?
Utenti che ritengono sia utile: 0 su 0