Fire this endpoint from the browser or mobile app whenever a meaningful user action occurs. Events are stored in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ALEJ4NDRO2025/urban-store/llms.txt
Use this file to discover all available pages before exploring further.
analytics_events MongoDB collection and power the dashboard, funnel, RFM, and alert views. No authentication is required, but including a JWT in the Authorization header associates the event with the logged-in user’s email (user_id).
Endpoint
Authentication
None required. If a validAuthorization: Bearer <token> header is present, the event is linked to the authenticated user’s email in the user_id field. Anonymous events are stored with user_id: null.
Request Body
The type of behavioral event being recorded. See the event types table below.
A stable UUID that identifies the browsing session. Store this in
localStorage and reuse it across page loads. If omitted, the server generates a new UUID — meaning session continuity is lost.URL slug of the product associated with this event (e.g.
"urban-cargo-pants"). Required for meaningful product_view, add_to_cart, and purchase events.Human-readable product name. Stored alongside
product_slug for display in the dashboard.Unit price in COP. Used to compute revenue in
purchase events. Stored as a string internally.Arbitrary key-value bag for additional context. For
purchase events, include quantity to enable accurate revenue calculations (e.g. {"quantity": 2}).Traffic source that brought this user to the store. Examples:
"google", "direct", "instagram", "social". Used to populate the traffic sources dashboard widget.Human-readable error description. Include when firing error event types such as
payment_error, checkout_error, payment_confirmation_error, or address_error. Stored directly on the event document for debugging in the dashboard.A client-generated unique key for this specific event fire. If the same key is seen again within 5 seconds, the event is silently discarded and
{"status": "duplicate_ignored"} is returned. If omitted, the server generates one from a SHA-256 hash of session_id + event_type + product_slug + timestamp.Idempotency
To prevent double-counting caused by network retries or React re-renders, generate a uniqueidempotency_key per event fire (e.g. crypto.randomUUID()). Events with a matching key received within 5 seconds of the original return 200 {"status": "duplicate_ignored"} without writing to the database.
Event Types
| Event Type | When to fire |
|---|---|
page_view | User loads any page |
product_view | Product detail page is rendered |
add_to_cart | User adds an item to their cart |
begin_checkout | User navigates to the checkout flow |
purchase | Order payment is confirmed (fire after confirm-payment succeeds) |
checkout_started | Checkout form is opened / mounted |
payment_info_entered | User submits the payment details form |
order_completed | Order confirmation page is viewed |
payment_error | Stripe payment attempt fails |
checkout_error | Checkout form validation or submission error |
whatsapp_cart_click | User clicks the “Comprar por WhatsApp” button |
whatsapp_purchase | WhatsApp purchase is manually confirmed |