Skip to content

fix(optimizely-x): capture campaignId for Personalization campaigns#1468

Merged
Matus Tomlein (matus-tomlein) merged 4 commits intomasterfrom
fix/optimizely-personalization-campaign-id
Apr 20, 2026
Merged

fix(optimizely-x): capture campaignId for Personalization campaigns#1468
Matus Tomlein (matus-tomlein) merged 4 commits intomasterfrom
fix/optimizely-personalization-campaign-id

Conversation

@matus-tomlein
Copy link
Copy Markdown
Contributor

@matus-tomlein Matus Tomlein (matus-tomlein) commented Apr 20, 2026

Reopens PR #1463 with some formal adjustments for release.

Blocked by schema release snowplow/iglu-central#1483

Copilot AI review requested due to automatic review settings April 20, 2026 07:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Optimizely X browser plugin to correctly attribute Optimizely Personalization campaigns by capturing campaignId (layerId) via the Optimizely state campaign APIs, and bumps the emitted context schema version accordingly.

Changes:

  • Switch Optimizely state extraction from active experiment IDs to active campaign states to include campaignId.
  • Extend OptimizelyxSummary context interface with optional campaignId.
  • Update the emitted context schema version to 1-1-0.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
plugins/browser-plugin-optimizely-x/src/index.ts Uses getCampaignStates({ isActive: true }), adds campaignId to emitted context, and bumps schema version to 1-1-0.
plugins/browser-plugin-optimizely-x/src/contexts.ts Adds campaignId?: number | null to the summary context type.
plugins/browser-plugin-optimizely-x/pnpm-lock.yaml Introduces a per-package pnpm lockfile (not aligned with the repo’s Rush setup).
Files not reviewed (1)
  • plugins/browser-plugin-optimizely-x/pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/browser-plugin-optimizely-x/src/index.ts Outdated
Comment thread plugins/browser-plugin-optimizely-x/src/index.ts
Comment thread plugins/browser-plugin-optimizely-x/pnpm-lock.yaml Outdated
- Remove stray per-package pnpm-lock.yaml (conflicts with Rush-managed
  lockfile at common/config/rush/pnpm-lock.yaml and pinned stale versions)
- Restore trailing newlines on contexts.ts and index.ts to match the
  rest of the codebase
- Drop misleading inline comment on campaignId (field is populated for
  both Web Experimentation and Personalization, not just Personalization)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Older Optimizely SDK versions don't expose state.getCampaignStates.
Without this guard the call throws at runtime and prevents every
context the plugin would attach, not just the Optimizely one.
Return an empty array instead so the tracker keeps working.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@matus-tomlein Matus Tomlein (matus-tomlein) changed the title Fix optimizely personalization campaign attribution fix(optimizely-x): capture campaignId for Personalization campaigns Apr 20, 2026
@matus-tomlein Matus Tomlein (matus-tomlein) merged commit 86a1f47 into master Apr 20, 2026
6 of 7 checks passed
@matus-tomlein Matus Tomlein (matus-tomlein) deleted the fix/optimizely-personalization-campaign-id branch April 20, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants