Beyond Collect.js: Backend Cart Modifications in Salesforce Marketing Cloud

In a typical marketing cloud abandon cart behavioral trigger implementation, cart modifications are facilitated by Collect.js, configured on the website. However, there are scenarios where the cart needs to be updated or cleared from the backend, especially in cases where Collect.js might not work.


Scenarios for Backend Cart Modification

1. In-Store Checkout

Scenario: A customer checks out at a physical store where the cart is synced.

Action: The backend updates the cart to reflect the in-store purchase.


2. Mobile Device Checkout

Scenario: Checkout on mobile devices with a different mechanism.

Action: Collect.js is not applicable on mobile, necessitating backend updates for a seamless experience.


By inspecting the website's cart page where collect.js is implemented and navigating to the network tab while searching for "igo," you can find the details of these API requests. 

API Endpoint:

Method: POST
Endpoint: https://nova.collect.igodigital.com/c2/your_MID/track_cart
Authentication: No authentication is required for this endpoint.

1
https://nova.collect.igodigital.com/c2/your_MID/track_cart

Payload to update cart:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
  "payload": {
    "cart": [
      {
        "item": "22098765",
        "quantity": "2",
        "price": "29.99",
        "unique_id": "20080292"
      },
      {
        "item": "22017432",
        "quantity": "3",
        "price": "49.99",
        "unique_id": "20088817"
      },
      {
        "item": "22032501",
        "quantity": "1",
        "price": "64.99",
        "unique_id": "20080089"
      }
    ],
    "url": "https://www.examplestore.com/cart/items.htm",
    "user_info": {
      "email": "exampleuser@email.com"
    }
  }
}

Payload to clear cart:

1
2
3
4
5
6
7
8
9
{
  "payload": {
    "clear_cart": true,
    "url": "https://www.examplestore.com/cart/empty.htm",
    "user_info": {
      "email": "newuser@example.com"
    }
  }
}

No comments:

Post a Comment

Powered by Blogger.