Add website view analytics for dashboard traffic charts.

Track storefront views via POST /tenants/{domain}/analytics/views, expose business activity API, and add product/website/portfolio/blog 30-day chart types for super-admin selection.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-26 01:12:44 +03:30
co-authored by Cursor
parent b8f60c5141
commit 3f266a2dcb
15 changed files with 414 additions and 0 deletions
+5
View File
@@ -54,6 +54,11 @@ Public marketplace listings owned by customers — not catalog `products`.
- `GET /tenants/{domain}/user-products/{slug}/technical-info` — category form + values
Use product categories from `GET /tenants/{domain}/categories?entityType=product` for filters. Creating/editing listings is customer-dashboard only (`/businesses/.../my-user-products`), not website-facing.
### Analytics (dashboard charts)
Record storefront views so the business home charts can show traffic:
- `POST /tenants/{domain}/analytics/views` body `{ "kind": "website"|"product"|"portfolio"|"blog", "entityId"?: "...", "path"?: "/about" }`
- Call once per page view from the website (product detail, portfolio, blog post, or general pages with `kind: "website"`).
### Static images
Named slots the business dashboard can replace. Fetch once per page:
- `GET /tenants/{domain}/website/static-images` — all slots
+55
View File
@@ -430,6 +430,61 @@
}
}
},
"/tenants/{domain}/analytics/views": {
"post": {
"tags": ["Analytics"],
"summary": "Record a storefront page view",
"description": "Fire-and-forget view counter for business dashboard charts. Call once per page impression from the website (product detail, portfolio, blog post, or general site page). No auth required.",
"parameters": [
{
"$ref": "#/components/parameters/domain"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["kind"],
"properties": {
"kind": {
"type": "string",
"enum": ["website", "product", "portfolio", "blog"]
},
"entityId": {
"type": "string",
"description": "Required when kind is product, portfolio, or blog."
},
"path": {
"type": "string",
"description": "Optional page path for website visits (e.g. `/`, `/about`)."
}
}
}
}
}
},
"responses": {
"200": {
"description": "View recorded",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"ok": { "type": "boolean", "enum": [true] }
}
}
}
}
},
"404": {
"description": "Unknown domain or entity"
}
}
}
},
"/tenants/{domain}/website/sliders": {
"get": {
"tags": [