add privacy-first analytics with progressive event collection
All checks were successful
deploy / deploy (push) Successful in 3m20s
All checks were successful
deploy / deploy (push) Successful in 3m20s
Three-layer pipeline: Plug for all HTTP requests (no JS needed), LiveView hook for SPA navigations, JS hook for screen width. ETS-backed buffer batches writes to SQLite every 10s. Daily-rotating salt for visitor hashing. Includes admin dashboard with date ranges, visitor trends, top pages, sources, devices, and e-commerce conversion funnel. Oban cron for 12-month data retention. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
defmodule Berrypod.Repo.Migrations.CreateAnalyticsEvents do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:analytics_events, primary_key: false) do
|
||||
add :id, :binary_id, primary_key: true
|
||||
add :name, :string, null: false
|
||||
add :pathname, :string, null: false
|
||||
add :visitor_hash, :binary, null: false
|
||||
add :session_hash, :binary, null: false
|
||||
add :referrer, :string
|
||||
add :referrer_source, :string
|
||||
add :utm_source, :string
|
||||
add :utm_medium, :string
|
||||
add :utm_campaign, :string
|
||||
add :country_code, :string, size: 2
|
||||
add :screen_size, :string
|
||||
add :browser, :string
|
||||
add :os, :string
|
||||
add :revenue, :integer
|
||||
|
||||
timestamps(type: :utc_datetime, updated_at: false)
|
||||
end
|
||||
|
||||
create index(:analytics_events, [:inserted_at])
|
||||
create index(:analytics_events, [:name, :inserted_at])
|
||||
create index(:analytics_events, [:session_hash, :inserted_at])
|
||||
create index(:analytics_events, [:pathname, :inserted_at])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user