Big Crunch

Search Documentation

Search across all documentation pages

Session Attribution

BCLighthouseTag.session is the session-scoped companion to BCLighthouseTag.metadata. Where metadata carries page-scoped facts like acct_type, session carries attribution and identity that belong to the visitor's session: all seven UTM parameters plus an optional publisher user identifier. Values you set here persist for the rest of the session — you don't need to re-declare them on every page.

Fields

  • utm_source, utm_medium, utm_campaign, utm_term, utm_content, utm_adset, utm_ad — session attribution. Auto-detected from the landing URL's query parameters (and referrer) on every session; set them here to override.
  • external_id — your own identifier for the visitor, recorded alongside Big Crunch's user_id on the underlying event data. Session-scoped and consent-gated.

How It Works

  1. Auto-detection fills attribution first. On session start (and mid-session re-entry from an external referrer) Big Crunch reads the UTM parameters from the page URL and classifies the referrer, exactly as it does today.
  2. Anything you set overrides auto-detection and is written through to the session cookie — it persists across pages without re-declaration.
  3. Last write wins, from anyone. A later explicit set replaces an earlier one. A mid-session re-entry (the visitor leaves and comes back through a new external referrer) re-stamps attribution and clears earlier overrides — and can itself be overridden by a set that runs after it. Setting a field to null clears your override back to the auto-detected value.
  4. Session scope. Everything here dies with the session (30 minutes idle). The next session starts fresh from auto-detection.

The bundle re-reads BCLighthouseTag.session every time it builds an analytics event, so you can assign values at any point — even asynchronously after your consent or login flow resolves. A late assignment applies from the next event onward.

session_source / session_medium in reporting are always derived from the effective UTM values and referrer — they can't be set directly. Override utm_source / utm_medium and the derived values follow.

Set UTM Parameters

<script>
  window.BCLighthouseTag = window.BCLighthouseTag || { cmd: [] };
  window.BCLighthouseTag.session = window.BCLighthouseTag.session || {};
  window.BCLighthouseTag.session.utm_source = "newsletter";
  window.BCLighthouseTag.session.utm_medium = "email";
  window.BCLighthouseTag.session.utm_campaign = "spring-sale";
  window.BCLighthouseTag.session.utm_adset = "loyal-readers";
  window.BCLighthouseTag.session.utm_ad = "hero-variant-b";
</script>

Use property-assignment (session.utm_source = ...) rather than replacing the whole session object, and place inline declarations above the install snippet (the same rules as metadata). After the bundle has loaded you can assign directly at any time:

Omit fields you aren't setting. A missing key is not a write — auto-detection and your earlier overrides stand. An empty string ("") is treated the same as null: a clear back to the auto-detected value, not an override. So don't pad your declaration with "" placeholders — on a later page they would clear overrides you set earlier.
// e.g. after your SSO resolves
BCLighthouseTag.session.utm_campaign = "member-drive";

// clear an override back to the auto-detected value
BCLighthouseTag.session.utm_campaign = null;

To re-assert a value after a mid-session re-entry has re-stamped attribution, assign it again with a value that differs from your last assignment (or set null first) — re-running an assignment of the identical value is indistinguishable from no change.

Set an External ID

external_id ties Big Crunch sessions to your own user space for reporting joins. Pass an opaque or hashed identifier — never an email address or other raw personal data:

<script>
  window.BCLighthouseTag = window.BCLighthouseTag || { cmd: [] };
  window.BCLighthouseTag.session = window.BCLighthouseTag.session || {};
  // your stable, hashed user identifier
  window.BCLighthouseTag.session.external_id = "9f8b6c…";
</script>
external_id is treated as an identity signal: it is only stored and sent when the visitor's consent state allows identity storage — the same gate as Big Crunch's own user ID. Where consent blocks it, it is silently omitted. It expires with the session and is never persisted durably.

Reporting

  • utm_adset and utm_ad appear as the UTM ad set and UTM ad dimensions in reporting, alongside the existing UTM dimensions.
  • external_id is not a reporting dimension — it rides the underlying event data for exports and joins.