Skip to content

Docs: document Campaigns analytics context#32

Merged
alexphelps merged 3 commits into
mainfrom
campaigns-analytics-context-docs
Jul 22, 2026
Merged

Docs: document Campaigns analytics context#32
alexphelps merged 3 commits into
mainfrom
campaigns-analytics-context-docs

Conversation

@next-devin

Copy link
Copy Markdown
Contributor

Summary

  • document the campaign identifiers attached to SDK analytics events
  • describe RudderStack campaign and page context fields
  • document session-based cart_id and checkout_id correlation plus coupon and discount properties

Validation

  • npm run build
  • verified field behavior against the Campaign Cart SDK event builder and RudderStack adapter
  • public-boundary scan for private references and legacy brand terms

The standalone link validator continues to report the repository's existing relative-link and invalid-fragment baseline; this change adds no internal links.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 21, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
developer-docs b8a783a Commit Preview URL

Branch Preview URL
Jul 21 2026, 10:07 AM

@next-devin
next-devin marked this pull request as ready for review July 21, 2026 09:38

## Campaign and Journey Context

RudderStack events include the campaign context provided by the SDK using the original snake_case field names:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Misleading framing — the intro promises "campaign context ... using the original snake_case field names", but the table that follows also lists page_type and page_name, which are page-context fields, not campaign fields. Either move page-context fields into a separate sub-section or rewrite the intro to describe the full scope (campaign + page + journey IDs).


| Field | Description |
| --- | --- |
| `campaign_id` | Campaign ID |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: The descriptions for campaign_id/campaign_name/campaign_currency/campaign_language/campaign_session_id are tautological — they just restate the field name ("Campaign ID", "Campaign name", etc.). The index.mdx table gives richer descriptions (e.g. "Campaign ID returned by the Campaigns API"). Align these so the same field reads consistently across the two docs.

| `page_type` | Current funnel page type |
| `page_name` | Current funnel page name |

The adapter also uses the SDK session ID to connect events across the funnel:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Sentence claims "the adapter also uses the SDK session ID to connect events across the funnel", but none of the three bullets that follow mention a session ID — they describe cart_id, checkout_id, coupon, and discount, which are object/cart correlation IDs, not session IDs. Either move the session-ID bullet up (e.g. add one explaining campaign_session_id correlation) or rewrite the lead-in to match the actual content (cart/checkout/coupon correlation).

campaign_name: 'Summer Campaign',
campaign_currency: 'USD',
campaign_language: 'en',
campaign_session_id: 'ncsid_abc123',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: This example payload contains two different session IDs with two different prefixes (campaign_session_id: 'ncsid_abc123' here, vs _metadata.session_id: 'sess_abc123' later in the same block) but doesn't explain how they relate or which one a downstream consumer should treat as canonical for funnel/session analytics. Add a one-line note clarifying the distinction (e.g. campaign session vs SDK internal event session) so readers don't double-count sessions.

| `campaign_name` | Campaign name |
| `campaign_currency` | Campaign currency |
| `campaign_language` | Campaign language |
| `campaign_session_id` | Session ID from the Campaigns session-tracking cookie |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: "Session ID from the Campaigns session-tracking cookie" doesn't name the actual cookie, so readers can't inspect, clear, or configure it. Either name the cookie (the api/index.mdx page references a session-tracking snippet — link there) or replace the parenthetical with a link to the session-tracking documentation.

| `campaign_language` | Campaign language |
| `campaign_session_id` | Session ID from the Campaigns session-tracking cookie |

Configure the campaign API key before the SDK loads so the SDK can retrieve the campaign record and populate these fields.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: "Configure the campaign API key before the SDK loads" gives no link, no example, and no failure-mode description. Readers will hit this and not know (a) where to set the key, (b) what config key name to use (window.nextConfig.apiKey?), or (c) what happens if the key is missing or set after load — do events still fire with campaign_* fields as undefined, get dropped, or log a warning? Link to /docs/campaigns/configuration (or the analytics configuration page), show a minimal example, and state the failure behavior.

@kilo-code-bot

kilo-code-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • content/docs/campaigns/analytics/examples/rudderstack.md
  • content/docs/campaigns/analytics/index.mdx
Previous Review Summaries (2 snapshots, latest commit 8cafa3b)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 8cafa3b)

Status: No Issues Found | Recommendation: Merge

All six issues from the previous review have been resolved by commit 8cafa3b:

  • rudderstack.md:67 — intro now correctly states "campaign and page context" (was misleading framing).
  • rudderstack.md:71/75campaign_id and campaign_session_id descriptions now add real context beyond restating the field name.
  • rudderstack.md:79-82 — lead-in rewritten to "SDK's internal analytics session ID as a correlation value" with bullets correctly stating "use it as cart_id/checkout_id".
  • index.mdx:128 — new paragraph disambiguates campaign_session_id (from ncsid) vs _metadata.session_id (from SDK).
  • index.mdx:140 — description now names the ncsid cookie and links to add-session-tracking.
  • index.mdx:142-150 — added config example (window.nextConfig.apiKey), link to /docs/campaigns/configuration, and explicit failure-mode docs (console warning + missing-key behavior).

Verified both internal links (/docs/campaigns/configuration and /docs/campaigns/api#add-session-tracking) resolve to existing pages.

Files Reviewed (2 files)
  • content/docs/campaigns/analytics/examples/rudderstack.md
  • content/docs/campaigns/analytics/index.mdx

Previous review (commit 7154af8)

Status: 6 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 4
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
content/docs/campaigns/analytics/examples/rudderstack.md 67 Intro promises campaign-only snake_case fields, but table also lists page-context page_type/page_name — misleading framing
content/docs/campaigns/analytics/examples/rudderstack.md 79 Lead-in claims session-ID correlation, but bullets describe cart/checkout/coupon IDs, not session IDs
content/docs/campaigns/analytics/index.mdx 94 Example shows two different session-ID prefixes (ncsid_ vs sess_) without explaining the distinction
content/docs/campaigns/analytics/index.mdx 140 "Configure the campaign API key before the SDK loads" — no link, no example, no failure-mode docs

SUGGESTION

File Line Issue
content/docs/campaigns/analytics/examples/rudderstack.md 71 Tautological field descriptions ("Campaign ID", "Campaign name", ...) — inconsistent with richer descriptions in index.mdx
content/docs/campaigns/analytics/index.mdx 138 "Campaigns session-tracking cookie" not named; cross-link to session-tracking docs
Files Reviewed (2 files)
  • content/docs/campaigns/analytics/examples/rudderstack.md - 3 issues
  • content/docs/campaigns/analytics/index.mdx - 3 issues

Fix these issues in Kilo Cloud


Reviewed by minimax-m3 · Input: 38.6K · Output: 2K · Cached: 188.4K

@next-devin
next-devin requested a review from alexphelps July 21, 2026 10:00
@alexphelps
alexphelps merged commit 79e17e3 into main Jul 22, 2026
2 checks passed
@next-devin
next-devin deleted the campaigns-analytics-context-docs branch July 22, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants