Skip to main content
The Attribution API serves two purposes: logging events from your server-side checkout handlers (highest-confidence attribution, because you know the session was AI-initiated), and pulling AI commerce metrics for your domain programmatically. Together these two capabilities give you a complete picture of which AI surfaces are driving discovery, checkout, and revenue — without depending solely on browser-side signals that can be blocked or misclassified. All calls require authentication — see Authentication.

Log an attribution event

Call this from your server when a UCP or ACP checkout is initiated or completed. Fire it asynchronously — attribution logging must never block or delay the customer’s checkout response.

Request parameters

string
required
The event type. See the event types table below for valid values.
string
required
Your store domain. Example: "yourstore.com"
string
required
A session identifier from your system — typically your checkout ID or order ID.
string
required
The protocol that initiated the session: "ucp" or "acp".
string
The specific AI surface that triggered this event, if known. Examples: "google_ai_mode", "chatgpt", "perplexity".
object
Additional event data. Common fields:
  • product_id — the product involved
  • variant_id — the specific variant selected
  • value — order value in smallest currency unit (cents or paise)
  • currency — ISO 4217 currency code
string
ISO 8601 timestamp. Defaults to the current time if omitted.

Event types

Example request:

Response fields

string
Unique identifier for this logged event.
string
Confirmation that the event was recorded. Value is always "recorded" on success.
boolean
Whether Asva was able to classify the session to a specific AI surface.
string
The AI surface Asva attributed this session to, based on your ai_surface field and its own signal analysis.
number
Attribution confidence score from 0 to 1. Values above 0.8 are high-confidence classifications.
Example response:

Integration examples

Add attribution logging to your UCP and ACP checkout handlers. Always fire asynchronously — do not await the Asva call:
Never await the attribution API call inside a checkout handler. If the Asva API is slow or unavailable, your customers’ checkouts must not be affected.

Pull attribution data

Retrieve AI commerce metrics for a domain. Use this to build reporting dashboards, pull data into BI tools, or run multi-client reports for agencies.

Query parameters

string
required
Domain to query. Example: "yourstore.com"
string
required
Start date in ISO 8601 date format. Example: "2026-03-01"
string
required
End date in ISO 8601 date format. Example: "2026-04-01"
string
Time granularity for the daily array: "day" (default), "week", or "month".
Example request:

Response fields

string
The domain queried.
object
The date range of the report, with start and end fields.
object
Aggregated metrics for the full period.
integer
Total sessions attributed to an AI surface.
integer
Total checkout sessions initiated from an AI surface.
integer
Total orders completed from an AI surface.
integer
Total revenue from AI-attributed orders, in smallest currency unit.
number
Orders divided by sessions, as a decimal. 0.131 = 13.1%.
integer
Average order value from AI-attributed orders, in smallest currency unit.
object
Sessions and orders broken down by AI surface. Keys include google_ai_mode, chatgpt, perplexity, and other_ai.
array
Day-by-day (or week/month) breakdown with date, sessions, checkouts, orders, and revenue_cents per period.
Example response:

Code examples