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:
co-authored by
Cursor
parent
b8f60c5141
commit
3f266a2dcb
@@ -0,0 +1,18 @@
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'website_view_kind') THEN
|
||||
CREATE TYPE website_view_kind AS ENUM ('website', 'product', 'portfolio', 'blog');
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS website_content_views (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
business_id BIGINT NOT NULL REFERENCES businesses (id) ON DELETE CASCADE,
|
||||
view_kind website_view_kind NOT NULL,
|
||||
entity_id BIGINT,
|
||||
page_path TEXT,
|
||||
viewed_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_website_content_views_business_kind_time
|
||||
ON website_content_views (business_id, view_kind, viewed_at DESC);
|
||||
Reference in New Issue
Block a user