Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SIW-1953] Mixpanel tracking of new ITWallet feature #6601

Open
wants to merge 6 commits into
base: SIW-1918-add-ipatente-cta-in-mdl-details-screen
Choose a base branch
from

Conversation

RiccardoMolinari95
Copy link
Collaborator

@RiccardoMolinari95 RiccardoMolinari95 commented Jan 14, 2025

Short description

This PR add the tracking on mixpanel of some ITWallet events

Warning

Depens on #6577

List of changes proposed in this pull request

  • trackItwStatusWalletAttestationFailure when the wallet attestation fails.
  • trackItwStatusCredentialAttestationFailure when the credential attestation fails
  • trackItwTrustmarkRenewFailure when the generation of the QR Code for attesting the authenticity of the credential fails
  • trackCredentialCardModal when a credential is viewed in landscape mode
  • trigger the event FIMS_START by clicking the CTA towards iPatente through the trackAuthenticationStart function
  • added in ItwPresentationDetailsFooter const for tracking iPatente service

How to test

Verify that the newly added events are tracked correctly

Copy link
Contributor

github-actions bot commented Jan 14, 2025

Jira Pull Request Link

This Pull Request refers to the following Jira issue SIW-1953

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 52.00000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 49.34%. Comparing base (483cdf2) to head (51238e9).
Report is 5 commits behind head on SIW-1918-add-ipatente-cta-in-mdl-details-screen.

Files with missing lines Patch % Lines
ts/features/itwallet/analytics/index.ts 60.00% 4 Missing ⚠️
...ion/screens/ItwPresentationCredentialCardModal.tsx 0.00% 3 Missing ⚠️
...reens/ItwPresentationCredentialFiscalCodeModal.tsx 0.00% 3 Missing ⚠️
...dentials/saga/checkCredentialsStatusAttestation.ts 0.00% 1 Missing ⚠️
...tation/components/ItwPresentationDetailsFooter.tsx 80.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                                 Coverage Diff                                 @@
##           SIW-1918-add-ipatente-cta-in-mdl-details-screen    #6601      +/-   ##
===================================================================================
- Coverage                                            49.37%   49.34%   -0.03%     
===================================================================================
  Files                                                 1566     1566              
  Lines                                                32247    32281      +34     
  Branches                                              7335     7334       -1     
===================================================================================
+ Hits                                                 15921    15930       +9     
- Misses                                               16276    16313      +37     
+ Partials                                                50       38      -12     
Files with missing lines Coverage Δ
...let/lifecycle/saga/checkWalletInstanceStateSaga.ts 92.30% <100.00%> (+0.64%) ⬆️
ts/features/itwallet/trustmark/machine/machine.ts 80.95% <100.00%> (+2.00%) ⬆️
...dentials/saga/checkCredentialsStatusAttestation.ts 5.26% <0.00%> (-0.30%) ⬇️
...tation/components/ItwPresentationDetailsFooter.tsx 67.56% <80.00%> (+1.94%) ⬆️
...ion/screens/ItwPresentationCredentialCardModal.tsx 17.64% <0.00%> (-3.79%) ⬇️
...reens/ItwPresentationCredentialFiscalCodeModal.tsx 34.78% <0.00%> (-5.22%) ⬇️
ts/features/itwallet/analytics/index.ts 34.40% <60.00%> (+1.45%) ⬆️

... and 28 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 483cdf2...51238e9. Read the comment docs.

@RiccardoMolinari95 RiccardoMolinari95 changed the title [SIW-1953] Tracking of new ITWallet feature [SIW-1953] Mixpanel tracking of new ITWallet feature Jan 14, 2025
Comment on lines +159 to +166
trackAuthenticationStart(
serviceId,
serviceName,
serviceOrganizationName,
serviceOrganizationFiscalCode,
label,
"message_detail"
);
Copy link
Contributor

@mastro993 mastro993 Jan 14, 2025

Choose a reason for hiding this comment

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

What do you think about creating a specific function for this tracking, removing the need to have const values here?
Also, I think message_detail is not correct for this specific use case. Should be something different, like "credential_detail".

failure: ({ event }) => mapEventToFailure(event)
failure: ({ event, context }) => {
const failure = mapEventToFailure(event);
trackItwTrustmarkRenewFailure(CREDENTIALS_MAP[context.credentialType]);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an assigment action, which should be pure. We should create an action specific for this tracking and call it in the entry transition of Failure state.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right, thanks for the suggestion. Addressed in 9318e43

const serviceOrganizationName =
"Ministero delle infrastrutture e dei trasporti";
const serviceOrganizationFiscalCode = "97532760580";
const serviceName = "Motorizzazione Civile - Le mie patenti";
Copy link
Contributor

Choose a reason for hiding this comment

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

What if the service is later renamed to something else? Or the organisation? Or what if the service is recreated, with different ids? Apart from keeping track of such changes, this code will send bad data to the mixpanel boards and we will have to release a new version of the application in order to change it.

Why do not we use a CDN to store these data?

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.

3 participants