MetaMask / metamask-mobile

Mobile web browser providing access to websites that use the Ethereum blockchain
https://metamask.io
Other
2.17k stars 1.12k forks source link

chore: update the remaining trackEvent calls to use new builder pattern #12262

Open NicolasMassart opened 6 days ago

NicolasMassart commented 6 days ago

What is this about?

Followup on #12180 that updated the metrics trackEvent and some files calling it, but not all. Finish the update of the files that are using trackEvent in the old way to use the new one with builder.

Scenario

No response

Design

No response

Technical Details

Example current code

const { trackEvent } = useMetrics();
...
trackEvent(MetaMetricsEvents.ACTIONS_BUTTON_CLICKED, {
  text: '',
  chain_id: getDecimalChainId(chainId),
});

Example target code

const { trackEvent, createEventBuilder } = useMetrics();
...
trackEvent(createEventBuilder(MetaMetricsEvents.ACTIONS_BUTTON_CLICKED)
      .addProperties({
      text: '',
      chain_id: getDecimalChainId(chainId),
    }).build()
  );

Threat Modeling Framework

No response

Acceptance Criteria

Files list

The list of the files to update is the following (some may be already fixed after I write this list)

see https://github.com/MetaMask/metamask-mobile/pull/12180#issuecomment-2471385209

Stakeholder review needed before the work gets merged

References

fix: trackevent enabled is undefined #12180

NicolasMassart commented 6 days ago

Note, some of the files listed above may already be fixed in #12180 See https://github.com/MetaMask/metamask-mobile/pull/12180#issuecomment-2471385209