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

[IOCOM-1848] Analytics for Push Notifications Engagement #6598

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

Vangaorth
Copy link
Contributor

Short description

This PR adds the analytics for the disabled push notification permissions engagement banners.

List of changes proposed in this pull request

  • BANNER: for Itw, PushNotification and ProfileSettings banners
  • TAP_BANNER: for Itw, PushNotification and ProfileSettings banners
  • CLOSE_BANNER: for Itw, PushNotification and ProfileSettings banners
  • PUSH_NOTIF_SYSTEM_ALERT: for system permissions popup
  • PUSH_NOTIF_THIRD_DISMISS_ALERT: for bottom sheet opening on third dismissal of the push notifications banner
  • PUSH_NOTIF_THIRD_DISMISS_ALERT_INTERACTION: for bottom sheet (above) interaction CTA
  • PUSH_NOTIF_BANNER_FORCE_SHOW: when the dismissed push notification banner has to be shown again
  • PUSH_NOTIF_BANNER_STILL_HIDDEN: when the dismissed push notification banner is not to be shown again

How to test

For every event, check that it is tracked with the proper properties

Copy link
Contributor

github-actions bot commented Jan 10, 2025

Jira Pull Request Link

This Pull Request refers to the following Jira issue IOCOM-1848

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.50%. Comparing base (9382eeb) to head (6076c08).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6598      +/-   ##
==========================================
+ Coverage   49.33%   49.50%   +0.16%     
==========================================
  Files        1565     1566       +1     
  Lines       32275    32370      +95     
  Branches     7290     7297       +7     
==========================================
+ Hits        15923    16024     +101     
+ Misses      16313    16307       -6     
  Partials       39       39              
Files with missing lines Coverage Δ
...ltiBanner/components/LandingScreenBannerPicker.tsx 100.00% <100.00%> (ø)
ts/features/pushNotifications/analytics/index.ts 100.00% <100.00%> (ø)
...tifications/components/PushNotificationsBanner.tsx 100.00% <100.00%> (+4.54%) ⬆️
...tions/hooks/usePushNotificationsBannerTracking.tsx 100.00% <100.00%> (ø)
.../sagas/profileAndSystemNotificationsPermissions.ts 100.00% <100.00%> (ø)
...ns/store/selectors/notificationsBannerDismissed.ts 100.00% <100.00%> (ø)
ts/screens/profile/ProfileMainScreenTopBanner.tsx 100.00% <100.00%> (ø)
ts/screens/profile/analytics/index.ts 53.12% <100.00%> (+10.81%) ⬆️
...ens/profile/components/SettingsDiscoveryBanner.tsx 100.00% <100.00%> (+25.00%) ⬆️

... and 1 file 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 9382eeb...6076c08. Read the comment docs.

event_type: "action",
banner_id: "push_notif_activation",
banner_page:
route === "MESSAGES_HOME" ? "MESSAGES_HOME" : "SETTINGS_MAIN",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
route === "MESSAGES_HOME" ? "MESSAGES_HOME" : "SETTINGS_MAIN",
route,

since this is a literal type, why not directly use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it is a tracked data that appears in Mixpanel reports. Let's say that we just do banner_page: route. The test succeeds. Mixpanel boards are created, with this value in the reports (MESSAGES_HOME and SETTINGS_MAIN).
In the future, someone changes the value of the literal. Test still succeed, no warning at all but Mixpanel boards start receiving data that was not mapped (and nobody may be aware of it for a while).

With this redundancy in the test, if someone changes the literal value, the test fails so we have an error that should trigger the author (of the change) to reflect upon the impact on mixpanel data.

event_type: "screen_view",
banner_id: "push_notif_activation",
banner_page:
route === "MESSAGES_HOME" ? "MESSAGES_HOME" : "SETTINGS_MAIN",
Copy link
Contributor

Choose a reason for hiding this comment

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

same here :p

const eventName = "CLOSE_BANNER";
const props = buildEventProperties("UX", "action", {
banner_id: "push_notif_activation",
banner_page: MESSAGES_ROUTES.MESSAGES_HOME,
Copy link
Contributor

Choose a reason for hiding this comment

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

since this banner is not attached to themessages_home screen, but rather to the current landing screen, would it make more sense to add the current route as a parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The event is related to the user manually closing the banner but (the banner) appears only in the messages' home and in the settings screen. Latter does not offer an option to close the banner so we do not have a use-case where the banner can be close anywhere but the messages' home

discardModal.present();
} else {
dispatch(setUserDismissedNotificationsBanner());
closeHandler();
}
};

const onPress = React.useCallback(() => {
trackPushNotificationsBannerTap(MESSAGES_ROUTES.MESSAGES_HOME);
Copy link
Contributor

Choose a reason for hiding this comment

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

why not use the useRoute hook to get the current route?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because this banner does not have an use case for a screen that is not the messages' home

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants