Skip to content

fix(analytics): fix user traits types for security_providers and has_marketing_consent#26792

Open
TanayK07 wants to merge 4 commits intoMetaMask:mainfrom
TanayK07:fix/analytics-traits-types
Open

fix(analytics): fix user traits types for security_providers and has_marketing_consent#26792
TanayK07 wants to merge 4 commits intoMetaMask:mainfrom
TanayK07:fix/analytics-traits-types

Conversation

@TanayK07
Copy link
Copy Markdown
Contributor

@TanayK07 TanayK07 commented Mar 2, 2026

Description

Fix Segment schema violations for user traits in identify calls:

  • traits.security_providers: was sending string ('blockaid' / ''), now sends string[] (['blockaid'] / [])
  • traits.has_marketing_consent: was sending string ('ON' / 'OFF'), now sends boolean (true / false)

Updated all call sites across the codebase (not just the generator function) to ensure consistent trait types.

Changelog

CHANGELOG entry: null

Related issues

Fixes: #23970

Manual testing steps

Feature: Analytics user traits types

  Scenario: security_providers trait is sent as array
    Given the user has Blockaid security alerts enabled
    When an identify call is made to Segment
    Then the security_providers trait is sent as ['blockaid']

  Scenario: security_providers trait is empty array when disabled
    Given the user has Blockaid security alerts disabled
    When an identify call is made to Segment
    Then the security_providers trait is sent as []

  Scenario: has_marketing_consent trait is sent as boolean
    Given the user has opted in to marketing data collection
    When an identify call is made to Segment
    Then the has_marketing_consent trait is sent as true (not "ON")

Screenshots/Recordings

N/A — no UI changes, only analytics trait type fixes.

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Low risk: changes are limited to analytics identify/trait payloads and corresponding tests, with no functional UI or state-management behavior changes expected beyond improved schema compliance.

Overview
Fixes Segment user-trait schema violations by standardizing security_providers to a string[] (['blockaid']/[]) and has_marketing_consent to a boolean (true/false) across all relevant identify/addTraitsToUser call sites.

Updates the user profile metadata types and generator, plus adjusts associated unit tests to assert the new trait shapes.

Written by Cursor Bugbot for commit ae2cc5d. This will update automatically on new commits. Configure here.

…marketing_consent

Fix Segment schema violations by updating `security_providers` from
string to string array (`['blockaid']` or `[]`) and `has_marketing_consent`
from string to boolean across all call sites.

Fixes MetaMask#23970
@TanayK07 TanayK07 requested review from a team as code owners March 2, 2026 14:56
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 2, 2026

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

TanayK07 added a commit to TanayK07/metamask-mobile that referenced this pull request Mar 11, 2026
- Revert production code changes (analytics traits types) that belong
  to PR MetaMask#26792, not this hex-color-replacement PR
- Move brandColor import before usage in FoxRiveLoaderAnimation test
  to avoid relying on babel import hoisting
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.

fix(analytics): fix user traits types violations

1 participant