Skip to content

Rebuy Analytic 2.0 Endpoints

POSThttps://rebuyengine.com/api/v2/analytics/event

Creates a single analytic event.

Headers

X-Rebuy-User-Token · string · required
Your key to use our API.
Content-Type · string · required
Must be application/json.

Body Parameters

subject · string · required
The subject of the event. Supported value: user.
verb · string · required
The action of the subject of the event. Supported values: viewed, added, removed.
noun · string · required
The object that the subject's action operated upon. Supported value: product.
product_id · string · required
The unique identifier of the noun field. Even if numeric, this must be passed as a string.
product_handle · string · required if product_id is not available
The product handle can be passed in lieu of the product_id if the noun is "product".
uuid · string · required
The 'Universally Unique Identifier' of the subject. The client is responsible for creating this token. We recommend using this NPM package (UUID). Example: be6f5fab-32a4-43e5-967c-68017baa3aa5
customer_id · string
The customer id can be passed to tie multiple UUIDs from different browsers together if the UUID for a customer is being stored in a cookie. Even if numeric, this must be passed as a string.
theme_id · string
The theme identifier that applies to the product.
platform · string · Default: Shopify
Commerce platform identification string.

Request Example

{
  "subject": "user",
  "verb": "viewed",
  "noun": "product",
  "uuid": "be6f5fab-32a4-43e5-967c-68017baa3aa5",
  "customer_id": "65069794",
  "product_id": "5630650697948"
}

Response Example

{
  "data": "Received"
}

How to Use

  1. Generate a UUID for the customer if one hasn't been created already.
  2. Build your POST data with the appropriate subject, verb, and noun (e.g., user, viewed, product) and corresponding product data (e.g., product_id).
  3. Submit your request when a customer views a product.

Once you've submitted data to this endpoint, you can call the /products/viewed endpoint using the customer's established UUID to get a list of products that they've viewed throughout their session.


POSThttps://rebuyengine.com/api/v2/analytics/event/bulk

Creates multiple analytic events in a single request (maximum 100 items).

Headers

X-Rebuy-User-Token · string · required
Your key to use our API.
Content-Type · string · required
Must be application/json.

Body Parameters

The request body is a JSON array of event objects. Each event object uses the same fields as the single event endpoint above.

Request Example

[
  {
    "subject": "user",
    "verb": "viewed",
    "noun": "product",
    "uuid": "be6f5fab-32a4-43e5-967c-68017baa3aa5",
    "customer_id": "65069794",
    "product_id": "5630650697948"
  },
  {
    "subject": "user",
    "verb": "viewed",
    "noun": "product",
    "uuid": "be6f5fab-32a4-43e5-967c-68017baa3aa5",
    "customer_id": "65069794",
    "product_id": "6506975630948"
  }
]

Response Example

{
  "data": "Received"
}

How to Use

  1. The general structure and usage is similar to the single event endpoint, however, up to 100 JSON events can be passed inside of a JSON array.
  2. Each event must contain all required fields.

Reference

UUID Generation

Generating a client-side UUID

At this time, the client is responsible for generating a UUID to be included with the request. We recommend using this NPM package (UUID) to generate the UUID. We also recommend storing this session-based UUID if you plan on using the /products/viewed endpoint.

See something that needs updating? Suggest an edit