Skip to content

[Sites] Measure Sites visits, interactions, and campaign attribution #2095

Open

Description

@sidneyswift

Parent epic: #2093

Priority

P1 — Next customer value after the shared integration release.

User story

As a label marketer, I want to know what fans did and which campaign brought them.

User journey

Fan opens a tagged campaign link → starts the experience → connects or skips music → completes an action → optionally signs up; the marketer can attribute those actions.

Acceptance criteria

  • Define versioned events for visits, experience starts/completions, music connection outcomes, player activity, outbound music clicks, and successful consented signups.
  • Record site, published revision, event ID, timestamp, bounded source/UTM fields, and a documented session identifier; deduplicate retries and exclude editor previews/test traffic.
  • Only trusted host code records verified signup/auth/player events; generated experience messages use an allowlisted protocol and are treated as untrusted interaction signals.
  • Document session/unique-visitor limitations, consent behavior, retention, and bot filtering. Do not include emails, credentials, or arbitrary query strings in event payloads.
  • Provide workspace-authorized aggregate reads through API and MCP. Label player activity separately from verified DSP streams; do not infer streams or revenue.

Owning code

API ingestion/aggregate reads; database events/retention; chat trusted event bridge.

Use the epic's API-first/MCP, workspace authorization, database migration, docs, and explicit-publishing requirements.

Blocking dependencies

These are completion prerequisites, mirrored in GitHub’s blocked-by links. Design and contract work may start earlier. Other coordination references are not blockers.

Validation

Exercise duplicate/offline retries, spoofed messages, unknown events, cross-tenant reads, no-consent mode, UTM parsing, and preview exclusion. Related app#2027 covers marketing-to-account attribution; reuse compatible parsing without conflating fan sessions and customer signup.

Platform foundation alignment

This remains part of Sites epic #2093. Recoup Sites and external apps must share primitives, authorization, and billing. Coordinate with:

The Blocking dependencies section is authoritative. Campaign release follows the external integration proof gate; independent design/test work can proceed earlier.

Measure first-party experience activity only within permitted provider use. Document supported collection and retention for the initial provider configuration within this ticket; do not create prohibited Spotify-derived profiling or listenership metrics.

Expanded measurement scope

Build collection into the shared Recoup connection/player and experience components so the same events work in Recoup Sites and independently hosted applications. Keep observed actions, observed results, and inferred meaning separate.

First delivery

  • Connection prompt shown, connect clicked/skipped, authorization completed/denied/failed, popup blocked, fallback used, player ready/unavailable, and time to readiness.
  • Play requested versus playback actually started, startup delay, playback failure, and outbound music-link clicks. Do not label these verified streams or proof that someone heard audio.
  • Experience load success/failure, first meaningful interaction, start, progress, completion, restart, and active interaction time distinct from elapsed page-open time.
  • Signup form shown/started, confirmed submission, independent marketing consent, and withdrawal. Never infer consent from provider login.
  • Traffic source, published version, browser/device category, and failures, with preview/test traffic excluded and missing data clearly represented.

Detailed player measurements

Define a provider-aware second layer for pause/resume, next/previous, seek-from/seek-to positions, track changes, deliberate replay, observed track ending/interruption, mute/volume changes, and player open/minimize/close. Capture which song and playback attempt an event belongs to.

Record both song position and estimated observed playback time: reaching 0:42 does not mean 42 seconds played. Exclude paused time and seek jumps. Mark gaps and uncertain endings rather than inventing exact completion or listening time. Separate local button intent from confirmed player state and automatic transitions; unknown causes remain unknown. Playback on another device must not be attributed to local listening without evidence.

Do not infer dislike from a skip or pause. Keep technical diagnostics separate from customer-facing song analysis; #2106 tracks later provider review; this ticket documents the initial supported signals and their limitations without waiting on that follow-up. Customer-owned audio and provider playback may support different measurement capabilities.

Experience-specific events

Allow a bounded, validated set of meaningful progress events declared by each experience (for example level completed or question reached). Keep generated-frame events distinguishable from trusted host-confirmed events. Never accept arbitrary event payloads or trust generated code to confirm auth, payment, or consent.

Customer outcomes

Record share-button clicks and copied links separately from visits arriving through shared links. Record ticket, merchandise, and music-service outbound clicks. Report purchases only when a connected commerce system confirms them; purchase integrations are follow-up work, not required for this first delivery. Never present a click as a completed share, purchase, or verified stream.

Common event context

  • Versioned event name/schema, unique event ID, occurrence/receipt time, application/workspace/campaign identifiers, and published revision.
  • Scoped session and playback-attempt identifiers; provider/track reference, song position, and observed playback estimate only where supported and appropriate.
  • Bounded campaign/source fields, browser/device category, page visibility, test/preview flag, and direct-versus-inferred evidence source.
  • Never include raw credentials, email addresses, arbitrary query strings, or unnecessary fingerprinting data. Do not link a fan across unrelated customer applications. Define consent-aware collection, retention, aggregation, deletion, and access controls.

Recoup operational measurements

Measure time to first working installation, installation verification outcomes, first real fan connection, active applications, repeat campaigns, generation/repair attempts, and recurring integration failures. Join these to authorized operation receipts from #2105 for costs, credits charged/refunded, and uncharged usage. Customer reports are workspace-scoped; Recoup operational reporting must not expose one customer's fan information to another. Support-request linkage can follow later.

Collection quality and cost

  • Capture meaningful state changes plus bounded checkpoints; batch delivery rather than sending an event every second. Configure limits and sampling without presenting sampled counts as exact totals.
  • Deduplicate retries, preserve ordering where possible, and handle offline delivery, tab closure, background throttling, and partial sessions. Mark incomplete data; delivery is not guaranteed.
  • Validate application/session binding and allowlisted event fields server-side; rate-limit ingestion and prevent public events from authorizing expensive work or arbitrary credit charges.
  • API/MCP reports expose definitions, denominators, measurement availability, freshness, and gaps; [Sites] Show Sites campaign results and traffic sources #2096 uses those same definitions.

Additional validation

Use deterministic sequences covering play-click without playback, pause/resume, seek-forward, repeat, automatic track transition, explicit skip, remote-device changes, hidden tabs, abrupt page close, duplicate/offline delivery, spoofed frame messages, and provider-unavailable measurements. Assert position differs from observed playback time, unsupported metrics are unavailable rather than zero, and previews never inflate campaign results.

Fan points coordination

Ordinary analytics events never directly award fan points. Qualifying reward actions use the authorization and duplicate-prevention path in #2113; coordinate shared action references without treating browser telemetry as verified results.

Activity

  1. added
    priority:P1Next customer value after the shared integration release
    on Sep 19, 2026
  2. sidneyswift commented on Nov 6, 2026

    @sidneyswift
    CollaboratorAuthor

    A first version shipped in recoupable/api#936. Published Sites record visit, start, complete, replay and share events with retry-safe IDs, and the workspace can read them. Release players record listening activity with campaign attribution (recoupable/api#993).

    Still open: a versioned event schema with source/UTM and published-revision fields, music-connection and outbound-click events, documented limits and retention, and an MCP read for Sites activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:P1Next customer value after the shared integration release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions