Skip to content

remove-newsletter-signup-ab-branching-and-clean-up-component-id-tracking#16232

Open
georgerichmond wants to merge 10 commits into
mainfrom
remove-newsletter-signup-ab-branching-and-clean-up-component-id-tracking
Open

remove-newsletter-signup-ab-branching-and-clean-up-component-id-tracking#16232
georgerichmond wants to merge 10 commits into
mainfrom
remove-newsletter-signup-ab-branching-and-clean-up-component-id-tracking

Conversation

@georgerichmond

@georgerichmond georgerichmond commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

What does this change?

Refactors EmailSignUpWrapper and related newsletter signup components to remove AB test scaffolding and simplify the component structure:

  • Removes AB test branching from EmailSignUpWrapper — the component now unconditionally renders NewsletterSignupCardContainer rather than switching between legacy EmailSignup/SecureSignup and the new card design
  • Removes subscription-check logic from EmailSignUpWrapper — drops useNewsletterSubscription, listId, idApiUrl, successDescription, hideNewsletterSignupComponentForSubscribers, and showNewNewsletterSignupCard props
  • Renames newsletter signup component IDs to be stable and context-descriptive (inArticleSignupForm, secureSignup, highlightsCard) rather than named after AB variants (control, variantIllustratedCard, variantNewField)
  • Threads componentId explicitly into NewsletterSignupForm and useNewsletterSignupForm rather than deriving it from abTest.variant, decoupling tracking from test state

Why?

The newsletters-signup-card-country-illustration AB test has concluded. The illustrated card design (variantIllustratedCard) is now the permanent behaviour, so the legacy EmailSignup/SecureSignup rendering path and all the AB test branching logic can be deleted.

The explicit componentId prop on NewsletterSignupForm resolves a TODO left in useNewsletterSignupForm — callers have the context to know which component ID to use, so the form itself shouldn't need to derive it from test metadata.

Screenshots

This is a refactor with no visual change — the rendered output is identical to the variantIllustratedCard branch that was already live.

Before After
N/A — no visual change N/A — no visual change

@github-actions

Copy link
Copy Markdown

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

@georgerichmond georgerichmond added maintenance Departmental tracking: maintenance work, not a fix or a feature run_chromatic Runs chromatic when label is applied labels Jun 22, 2026
@github-actions github-actions Bot removed the run_chromatic Runs chromatic when label is applied label Jun 22, 2026
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Refactors newsletter signup rendering/tracking to remove concluded A/B-test scaffolding, standardise component IDs, and explicitly thread the tracking component ID into the signup form/hook so tracking is no longer coupled to test state.

Changes:

  • Removes newsletter signup A/B branching and legacy component paths, consolidating on NewsletterSignupCardContainer + NewsletterSignupForm.
  • Introduces stable, context-based component ID helpers (inArticleSignupForm, secureSignup, highlightsCard) and updates tracking/tests accordingly.
  • Updates useNewsletterSignupForm / NewsletterSignupForm to accept an explicit componentId and forwards it into all tracking events.

Reviewed changes

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

Show a summary per file
File Description
dotcom-rendering/src/lib/useNewsletterSignupForm.ts Removes derived component-id logic; requires explicit componentId for tracking.
dotcom-rendering/src/lib/renderElement.tsx Simplifies NewsletterSignup element props; removes some feature-flag/legacy fields.
dotcom-rendering/src/lib/newsletterSignupTracking.ts Removes AB test constant; replaces variant-based IDs with stable IDs.
dotcom-rendering/src/lib/newsletterSignupTracking.test.ts Updates ID expectations and abTest assertions after refactor.
dotcom-rendering/src/components/SecureSignup.island.tsx Uses a stable secureSignup component ID regardless of abTest variant.
dotcom-rendering/src/components/SecureSignup.island.test.tsx Updates expectations for stable SecureSignup tracking ID.
dotcom-rendering/src/components/NewsletterSignupForm.island.tsx Adds required componentId prop and threads into hook.
dotcom-rendering/src/components/NewsletterSignupForm.island.test.tsx Updates test render helper to pass componentId.
dotcom-rendering/src/components/NewsletterSignupForm.island.stories.tsx Adds componentId to story args.
dotcom-rendering/src/components/NewsletterSignupCardContainer.tsx Updates preview tracking to use the stable in-article component ID.
dotcom-rendering/src/components/NewsletterSignupCardContainer.test.tsx Updates tracking assertions for new component ID helper.
dotcom-rendering/src/components/Masthead/Newsletter/HighlightsNewsletterSignupModal.tsx Passes explicit highlights component ID into NewsletterSignupForm.
dotcom-rendering/src/components/EmailSignUpWrapper.stories.tsx Removes AB scaffolding stories/mocks; updates scenarios for consolidated component.
dotcom-rendering/src/components/EmailSignUpWrapper.island.tsx Removes AB branching; always renders card + form and uses stable component ID.
dotcom-rendering/src/components/EmailSignUpWrapper.island.test.tsx Updates rendering/tracking assertions to reflect consolidated behavior and IDs.

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

Comment thread dotcom-rendering/src/components/EmailSignUpWrapper.island.tsx
Comment thread dotcom-rendering/src/components/EmailSignUpWrapper.island.tsx
Comment thread dotcom-rendering/src/lib/renderElement.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Departmental tracking: maintenance work, not a fix or a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove newsletter signup AB branching and clean up component ID tracking

2 participants