Skip to content

WS-3255: Decouple user id from personalisation - #14361

Merged
jinidev merged 14 commits into
latestfrom
WS-3255-decouple-user-id-from-personalisation
Oct 1, 2026
Merged

jinidev merged 14 commits into
latestfrom
WS-3255-decouple-user-id-from-personalisation

Conversation

@elvinasv

@elvinasv elvinasv commented Sep 2, 2026 •

Copy link
Copy Markdown
Member

.Resolves JIRA: https://bbc.atlassian.net/browse/WS-3255

Summary

This pull request adds support for tracking whether personalisation is enabled for a user in the ATI analytics payloads. It introduces a new isPersonalisationOn property, ensures it is passed through all relevant analytics functions, and updates the tests and types accordingly. Additionally, it determines the value of isPersonalisationOn based on user sign-in status, article personalisation availability, and a claim in the user's JWT.

Code changes

Personalisation tracking integration:

  • Added an isPersonalisationOn property to analytics types (ReverbUserVars, ATIPageTrackingProps) and ensured it is included in all analytics payloads and function signatures.

  • Updated all relevant tests to include and expect the new isPersonalisationOn property in analytics objects.

Personalisation state determination:

  • In AccountContext, added logic to decode the user's JWT and determine if they have opted out of personalisation (based on the ep claim), then set isPersonalisationOn accordingly

  • Passed the computed isPersonalisationOn value through the context to downstream consumers.

So the logic is:

signed out →  isPersonalisationOn = false
signed in + opt-in / no opt-out → isPersonalisationOn =  true if the relevant feature toggle is enabled
signed in + ep === false →  isPersonalisationOn= false

Reference: https://bbc.atlassian.net/wiki/spaces/DAS/pages/834247434/SPIKE+RVRB-509+-+Reverb+Investigate+approach+for+Decoupling+User+ID+from+Personalisation#Proposal-1:-Orbit/WS/Webcore-should-provide-value-for-isPersonalisationOn-boolean

Signed out & Personalisation ON
image

SignedIn& Personalisation ON
image

Signedin & Personalisation ON
image

SIgnedout & Personalisation OFF
image

@jinidev
jinidev marked this pull request as ready for review September 23, 2026 08:18
Copilot AI lite review requested due to automatic review settings September 23, 2026 08:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Several analytics event paths omit the new state, and SSR can report an incorrect affirmative value.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds isPersonalisationOn tracking, derived from personalisation availability and JWT claims, and propagates it through account state and ATI/Reverb analytics.

Changes:

  • Extends account, analytics, and browser API types.
  • Threads personalisation state through page analytics.
  • Updates related tests and fixtures.
File Reviewed changes
src/​global.d.ts Extends the bbcuser API.
src/​app/​pages/​ArticlePage/​index.test.tsx Updates article analytics fixtures.
src/​app/​models/​types/​account.ts Adds account context state.
src/​app/​lib/​analyticsUtils/​setBbcPage/​index.ts Exposes personalisation state globally.
src/​app/​contexts/​ReverbParamsContext/​index.tsx Passes state into analytics parameters.
src/​app/​contexts/​ReverbParamsContext/​index.test.tsx Updates context expectations.
src/​app/​contexts/​AccountContext/​index.tsx Calculates state from toggles and JWT claims.
src/​app/​contexts/​AccountContext/​index.test.tsx Tests personalisation enablement.
src/​app/​components/​ATIAnalytics/​types.ts Extends analytics types.
src/​app/​components/​ATIAnalytics/​params/​index.ts Forwards the new parameter.
src/​app/​components/​ATIAnalytics/​params/​index.test.ts Updates parameter fixtures.
src/​app/​components/​ATIAnalytics/​params/​buildParams/​index.ts Builds parameters with the state.
src/​app/​components/​ATIAnalytics/​params/​buildParams/​index.test.ts Updates builder expectations.
src/​app/​components/​ATIAnalytics/​index.client.test.tsx Updates analytics container expectations.
src/​app/​components/​ATIAnalytics/​atiUrl/​index.ts Adds state to page-view payloads.
src/​app/​components/​ATIAnalytics/​atiUrl/​index.client.test.ts Updates page-view model tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/app/components/ATIAnalytics/types.ts
Comment thread src/app/contexts/AccountContext/index.tsx
@jinidev jinidev changed the title WS-3255: Decouple user id from personalisation [WIP] WS-3255: Decouple user id from personalisation Sep 23, 2026
@jinidev
jinidev merged commit 07f9176 into latest Oct 1, 2026
18 checks passed
@jinidev
jinidev deleted the WS-3255-decouple-user-id-from-personalisation branch October 1, 2026 13:34
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.

6 participants