Send a page view from the storefront (tracking snippet)
- Path
/push/{accessToken}- Auth
- Access token · in the URL path
const url = 'https://releva.ai/api/v0/push/YOUR_ACCESS_TOKEN';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"context":{"cart":{"products":[]}}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://releva.ai/api/v0/push/YOUR_ACCESS_TOKEN \ --header 'Content-Type: application/json' \ --data '{ "context": { "cart": { "products": [] } } }'The call the JavaScript SDK makes on every page (Releva.push). Authenticated with the shop’s access token,
in the path (as the SDK does, to avoid a CORS pre-flight) or as authorization: Bearer <accessToken> on /push.
Returns the personalized elements for the page. This fragment covers only the minimal request used to check an
installation; the full context object is defined in the events-tracking fragment.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The shop’s access token (Settings › Shop & Integration › General › Access Token).
Example
YOUR_ACCESS_TOKENRequest Bodyrequired
Section titled “Request Bodyrequired”object
object
Strict object (unknown keys are rejected). Full definition in the events-tracking fragment.
object
Example
{ "context": { "cart": { "products": [] } }}Responses
Section titled “Responses”Personalized elements for the page.
object
object
object
object
object
Example
{ "recommenders": [], "banners": [], "stories": [], "push": { "vapidPublicKey": "<vapid-public-key>" }, "gtmId": null, "clientIp": "203.0.113.10", "userAgent": "curl/8.7.1"}Missing or unknown access token, or invalid context.
object
Human-readable error. Several validation errors are joined with a space.
Examples
{ "message": "Authorization header is missing, and accessToken url parameters is also missing. At least one of them is required."}{ "message": "Domain with the provided access token cannot be found."}{ "message": "The access token you provided is invalid."}{ "message": "The object '' contains forbidden keys: 'foo'."}The domain is disabled.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "Domain is disabled. Please reach out to support@releva.ai to enable it."}Unexpected server error.
object
Human-readable error. Several validation errors are joined with a space.
Example
{ "message": "An internal error occurred."}