Skip to main content

Documentation 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.

The funnel endpoint calculates how many unique browsing sessions reached each stage of the purchase funnel within a given date window. Each count is the number of distinct session_id values that fired at least one event of that type — providing a true drop-off view rather than a raw event volume. You can narrow the analysis by date range and filter to a single traffic source to compare acquisition channels.

Endpoint

GET /api/analytics/funnel/

Authentication

Bearer token required with is_admin: true in the JWT payload. Returns 403 if the user is not an admin.

Query Parameters

start
string
Start of the analysis window in YYYY-MM-DD format (e.g. 2024-04-01). Defaults to 30 days ago from the time of the request. Returns 400 if the date string cannot be parsed.
end
string
End of the analysis window in YYYY-MM-DD format (e.g. 2024-04-30). Defaults to now. Returns 400 if the date string cannot be parsed.
source
string
Filter to sessions that originated from a specific traffic source (e.g. "google", "direct", "instagram"). When omitted, all sources are included. The filter is applied at the individual event level — a session is included in a step only if it fired that event with the matching source value.

Funnel Steps

The funnel always contains these five steps in this order:
StepEvent TypeDescription
1page_viewUser visited the store
2product_viewUser viewed a product detail page
3add_to_cartUser added an item to their cart
4begin_checkoutUser initiated checkout
5purchaseUser completed a purchase
Each count is the number of unique session IDs that fired at least one event of that type within the requested window. Sessions with session_id: null are excluded.

Response

funnel
array
Ordered array of funnel step objects.
start_date
string
ISO 8601 timestamp of the start of the analysis window.
end_date
string
ISO 8601 timestamp of the end of the analysis window.

Example

curl -X GET "https://api.urbanstore.co/api/analytics/funnel/?start=2024-05-01&end=2024-05-31&source=google" \
  -H "Authorization: Bearer <admin_token>"
{
  "funnel": [
    { "step": "page_view",      "count": 840 },
    { "step": "product_view",   "count": 620 },
    { "step": "add_to_cart",    "count": 210 },
    { "step": "begin_checkout", "count": 78  },
    { "step": "purchase",       "count": 34  }
  ],
  "start_date": "2024-05-01T00:00:00",
  "end_date": "2024-05-31T00:00:00"
}
Cross-validate these numbers with GET /api/analytics/dashboard-stats/?mode=unique. The event_counts field in that response covers the last 7 days and should align with a funnel query for the same window.

Build docs developers (and LLMs) love