Integration

Events

Understand the event models that power Commerce Index Proof.

Product View Event

Sent when a user views a product detail page (PDP). This event powers the "X people viewed this" counter.

When to Send

  • When a visitor loads a product detail page
  • After the main product information is visible
  • Once per page load (avoid duplicate sends on scroll/interaction)

Data Model

{
  "brand_id": "brand_xyz",
  "product": {
    "product_id": "prod_123",        // required - your internal product ID
    "sku": "SKU-123-RED-M",          // optional
    "title": "Red Performance Legging",  // optional
    "url": "https://brand.com/products/red-performance-legging" // optional
  },
  "context": {
    "timestamp": "2025-12-22T15:30:00Z",
    "session_id": "sess_9a8b7c6d",   // auto-generated by ci.js
    "country": "US",
    "locale": "en-US",
    "user_agent": "Mozilla/5.0 ...",  // optional
    "referrer": "https://www.google.com/"  // optional
  }
}

Field Reference

product.product_id
Required
Your internal product identifier (must be consistent)
product.skuProduct SKU or variant identifier
product.titleProduct title for debugging
product.urlFull URL of the product page
context.session_idAuto-generated by ci.js for grouping
Product Purchase Event

Sent when an order is completed. This event powers the "Y purchases today" counter.

When to Send

  • On the order confirmation / "thank you" page
  • After payment is confirmed
  • Include all line items from the order

Data Model

{
  "brand_id": "brand_xyz",
  "order": {
    "order_id": "order_789",         // required - your internal order ID
    "currency": "USD",               // required
    "total_value": 129.97,           // optional
    "items": [                       // required - at least one item
      {
        "product_id": "prod_123",    // required
        "sku": "SKU-123-RED-M",      // optional
        "title": "Red Performance Legging",
        "quantity": 2,
        "unit_price": 39.99
      },
      {
        "product_id": "prod_456",
        "sku": "SKU-456-BLACK",
        "title": "Black Sports Bra",
        "quantity": 1,
        "unit_price": 49.99
      }
    ]
  },
  "context": {
    "timestamp": "2025-12-22T15:31:30Z",
    "session_id": "sess_9a8b7c6d",
    "country": "US",
    "locale": "en-US"
  }
}

Field Reference

order.order_id
Required
Your internal order identifier
order.currency
Required
ISO 4217 currency code (e.g., USD, EUR)
order.items
Required
Array of purchased products
items[].product_id
Required
Must match product_id from view events
items[].quantityNumber of units purchased (default: 1)
items[].unit_pricePrice per unit for analytics

Best Practices

Use consistent product IDs

The product_id in view events must match purchase events to link activity correctly.

Send events once per action

Avoid sending duplicate events on page interactions like scrolling or tab changes.

Include timestamps

While optional, timestamps help with debugging and accurate time window calculations.

Don't block rendering

The ci.js script loads asynchronously. Events are queued until the script is ready.