Skip to content

Remove marketing soft opt in for US: Hide toggle and apply removed soft opt in (client-side logic) #15877

@georgerichmond

Description

@georgerichmond

Overview

Implement the UI logic for removing the marketing soft opt in for US newsletter sign-ups. When enabled for signed out US users, the marketing toggle is hidden and the user is automatically opted into similar_guardian_products.

Acceptance Criteria

  • Add a helper to check whether the US soft opt-in switch is enabled (via window.guardian.config.switches.us-signup-hide-marketing-toggle)
  • Use the useCountryCode hook to determine country
  • In all sign-up surfaces (SecureSignup, NewsletterSignupForm, ManyNewsletterSignUp):
    • If the switch is OFF, current behaviour (toggle visible for all users)
    • If the switch is ON and countryCode === 'US', hide the toggle and always POST marketing=true
    • All other countries: toggle visible as normal
    • No changes for signed-in users
  • Treat countryCode === undefined (pending) as non-US — show toggle while resolving
  • Add/update unit tests to cover US, non-US, and pending states
  • Ensure that a marketingOptInHidden field is included in the sign-up payload, alongside countryCode: 'US', when the hidden soft opt-in is applied
  • Analytics tracking: the marketingOptInType field sent in Ophan tracking events should reflect the soft opt-in case
    • When the toggle is hidden (US soft opt-in applied), send `marketingOptInType: 'similar-guardian-products-optin-hidden-us'
    • When the toggle is visible and the user opts in, send similar-guardian-products-optin
    • When the toggle is visible and the user opts out, send similar-guardian-products-optout
    • For signed-in users, omit marketingOptInType from the tracking payload
    • Applies to all three surfaces: SecureSignup, NewsletterSignupForm, ManyNewsletterSignUp

Additional Notes

  • The switch for this functionality is currently referred to as us-signup-hide-marketing-toggle in the codebase; ensure consistent usage across code, tests, and stories.
  • Parent issue: guardian/email-rendering#930

Metadata

Metadata

Labels

NEWSLETTERSNewsletters related work.featureDepartmental tracking: work on a new feature

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions