Skip to main content
The Analytics Collection endpoints allow your custom storefront to send pageview, custom event, and interaction data to RMZ for store analytics. These endpoints run on a separate rate limit from the main Storefront API to ensure analytics traffic never blocks store requests.
These endpoints are used internally by the RMZ analytics script (rmz-analytics.js) and the Storefront SDK. You can also call them directly from a custom storefront implementation.

Authentication

No Bearer token or secret key is required. The store is identified from the request domain/origin (same as other Storefront API endpoints).

Rate Limits

Analytics endpoints have their own per-IP rate limiting (separate from the main API):
LimitWindow
120 events per IP1 minute
Batch requests count each event in the batch against the rate limit.

POST /storefront/analytics/collect

Submit a single analytics event.

Headers

HeaderValueRequired
Content-Typeapplication/jsonYes

Body Parameters

ParameterTypeRequiredDescription
typestringNoEvent type: pageview, event, outbound_click. Default: event
session_idstringNoSession identifier (max 64 chars)
visitor_idstringNoPersistent visitor identifier (max 64 chars)
urlstringNoFull page URL (max 2000 chars)
pathstringNoPage path (max 500 chars)
event_namestringNoCustom event name (for type: event, max 100 chars)
propertiesobjectNoCustom event properties (for type: event)
titlestringNoPage title (for type: pageview, max 500 chars)
referrerstringNoReferrer URL (for type: pageview, max 2000 chars)
screen_widthintegerNoScreen width in pixels (for type: pageview)
destinationstringNoOutbound link URL (for type: outbound_click, max 2000 chars)
textstringNoLink text (for type: outbound_click, max 200 chars)

Example Request

curl -X POST "https://front.rmz.gg/api/storefront/analytics/collect" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "pageview",
    "session_id": "sess_abc123",
    "visitor_id": "vis_xyz789",
    "url": "https://mystore.com/products/game-key",
    "path": "/products/game-key",
    "title": "Premium Game Key - My Store",
    "referrer": "https://google.com",
    "screen_width": 1920
  }'

Response

Success (202)

{
  "status": "ok"
}

Error Responses

StatusDescription
400store_id could not be resolved from request context
429Rate limit exceeded (120 events/min per IP)
The response uses a 202 Accepted status code rather than 200 OK, indicating the event has been accepted for processing. The response format uses status instead of the standard success/data wrapper used by other Storefront API endpoints.

POST /storefront/analytics/collect/batch

Submit multiple analytics events in a single request. Reduces HTTP overhead for high-traffic storefronts.

Headers

HeaderValueRequired
Content-Typeapplication/jsonYes

Body Parameters

ParameterTypeRequiredDescription
eventsarrayYesArray of event objects (max 30 per batch). Each event has the same structure as the single collect endpoint body.

Example Request

curl -X POST "https://front.rmz.gg/api/storefront/analytics/collect/batch" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      {
        "type": "pageview",
        "session_id": "sess_abc123",
        "visitor_id": "vis_xyz789",
        "url": "https://mystore.com/",
        "path": "/",
        "title": "Home - My Store"
      },
      {
        "type": "event",
        "session_id": "sess_abc123",
        "visitor_id": "vis_xyz789",
        "event_name": "view_product",
        "properties": {"product_id": 101}
      }
    ]
  }'

Response

Success (202)

{
  "status": "ok",
  "processed": 2
}
The processed field indicates how many events from the batch were successfully processed.

Error Responses

StatusDescription
400events array is missing or empty, or store_id could not be resolved
429Rate limit exceeded (each event in the batch counts against the 120/min limit)
Batches are capped at 30 events. Any events beyond the 30th are silently dropped. If your storefront generates more than 30 events between flushes, send multiple batch requests.

Supported Event Types

TypeDescription
pageviewPage view with title, referrer, and screen width
eventCustom named event with arbitrary properties
outbound_clickClick on an external link with destination URL and text
The event types web_vital, js_error, time_on_page, and scroll_depth are silently skipped by the server and will not be recorded.