Admin analytics: heatmap per device, anteprima staff e analisi costi.

Separa heatmap mobile/desktop, opt-out analytics per operatori, dashboard costi con KPI e trend mensili.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-28 19:25:38 +02:00
co-authored by Cursor
parent e0e07e5316
commit 29c8afb94d
43 changed files with 1572 additions and 58 deletions
@@ -29,16 +29,36 @@ RSpec.describe "Analytics snapshots", type: :request do
end
it "rifiuta path esclusi" do
post "/analytics/snapshot",
params: {
path: "/admin/analytics",
device: "desktop",
width: 1440,
height: 900,
image: jpeg_upload
}
expect do
post "/analytics/snapshot",
params: {
path: "/admin/analytics",
device: "desktop",
width: 1440,
height: 900,
image: jpeg_upload
}
end.not_to change(AnalyticsPageSnapshot, :count)
expect(response).to have_http_status(:unprocessable_content)
expect(AnalyticsPageSnapshot.count).to eq(0)
end
it "salta snapshot con cookie anteprima staff" do
expect do
post "/analytics/snapshot",
params: {
path: "/prezzi-suppress",
device: "desktop",
width: 1440,
height: 2200,
image: jpeg_upload
},
headers: { "Cookie" => "#{Analytics::Suppress::COOKIE_NAME}=1" }
end.not_to change(AnalyticsPageSnapshot, :count)
expect(response).to have_http_status(:accepted)
body = JSON.parse(response.body)
expect(body["skipped"]).to eq(true)
expect(body["suppressed"]).to eq(true)
end
end