Skip to content

Collect analytics events ​

Every published HTML page already includes the DECA Edge analytics beacon. The deployment pipeline adds it while finalizing the site, so you do not install a script or send data to a third-party hostname.

The beacon posts pageviews to POST /_collect on the same distribution. A successful request returns 202.

Verify pageviews ​

Open the live site, navigate between a few pages, then open Analytics in the console. Recent activity appears in Realtime first. Aggregated panels can take longer to update.

The beacon records:

  • n — pageview
  • u — path and query string; attribution parameters are parsed from it
  • r — the referring domain on the first hit, then the previous path
  • s — a session seed that rotates after 30 minutes of inactivity or at UTC midnight
  • p — event properties

Edge strips the client IP, stores only the registrable referrer domain, does not create a persistent visitor id, and does not use localStorage for identity. The visitor hash rotates daily.

Send a custom event ​

Post from the page when the user completes the action. Reuse the edge_s session cookie so the custom event joins the same session as its pageviews.

javascript
function sessionSeed() {
  const match = document.cookie.match(/(?:^|; )edge_s=([^;]*)/);
  return match ? decodeURIComponent(match[1]) : '';
}

function track(name, properties = {}) {
  return fetch('/_collect', {
    method: 'POST',
    headers: { 'content-type': 'application/json' },
    credentials: 'same-origin',
    keepalive: true,
    body: JSON.stringify({
      n: name,
      u: location.pathname + location.search,
      r: document.referrer,
      s: sessionSeed(),
      p: properties
    })
  });
}

track('select_plan', { plan: 'pro' });

Custom properties are accepted as observed data first. Declare the useful ones before using them in goal predicates or analytics breakdowns; see Declare an analytics property.

Do not send secrets or personal data in event names, paths, or properties. Edge applies the distribution's PII policy to properties, but that is a guardrail rather than a reason to collect unnecessary data.

What collection does not expose ​

Agents and API clients can query aggregated analytics, but cannot read raw collect envelopes or write events through MCP. Events come from the distribution's /_collect visitor lane.

Collection is capped at 256 KiB and 60 requests per minute per distribution. See Limits.

Next ​