Skip to content

Conversation

@irfano
Copy link
Contributor

@irfano irfano commented Jan 22, 2026

Description

Implements Milestone 1 push notification tracking as outlined in the pe5sF9-4Xn-p2.

New Events:

  • woo_push_token_register_success - Tracked when Woo Core push token registration succeeds
  • woo_push_token_register_error - Tracked when registration fails, includes error details
  • wpcom_device_disable_push_notifications_success - Tracked when WPCOM notifications are disabled*
  • wpcom_device_disable_push_notifications_error - Tracked when disabling fails*
  • I didn't add disable events to the site list screen because it updates all sites in a single API call and already tracks specific success and error events.

Updated Events:

  • push_notification_received - Added common properties (is_jetpack_installed, is_jetpack_connected, is_jetpack_cp_connected, is_ciab, garden_partner
    )
  • push_notification_tapped - Added common properties

Refactoring:

  • NotificationAnalyticsTracker now uses siteId parameter instead of SiteModel
  • Added trackError() method for error event tracking with error details
  • Removed SiteStore dependency from NotificationMessageHandler

Test Steps

1. Test woo_push_token_register_success

Preconditions:

  • A test site with WooCommerce 10.4.0-dev (supports Woo Core push endpoint)
  • Feature flag WOO_PUSH_NOTIFICATIONS_SYSTEM enabled

Steps:

  1. Build the app with feature flag enabled
  2. Login to a site with WooCommerce 10.4.0-dev.
  3. Check logcat for the event.

Verify:
woocommerceandroid_woo_push_token_register_success Properties: is_jetpack_installed, is_jetpack_connected, is_jetpack_cp_connected, is_ciab, garden_partner.


2. Test woo_push_token_register_error

Preconditions:

  • A test site with WooCommerce version below 10.4.3 (no push endpoint support)
  • Feature flag WOO_PUSH_NOTIFICATIONS_SYSTEM enabled

Steps:

  1. Build the app with feature flag enabled.
  2. Login to the site.
  3. Check logcat for the event.

Verify:
woocommerceandroid_woo_push_token_register_error Properties: is_jetpack_installed, is_jetpack_connected, is_jetpack_cp_connected, is_ciab, garden_partner, error_description, error_type, error_code.


3. Test wpcom_device_disable_push_notifications_success

Preconditions:

  • A test site with WooCommerce 10.4.0-dev
  • Previously logged in with feature flag disabled (WPCOM device registered)

Steps:

  1. Build the app with feature flag disabled.
  2. Login to a site (this registers WPCOM device).
  3. Enable feature flag and rebuild the app.
  4. Login to the same site again.
  5. Check logcat for the event.

Verify:
woocommerceandroid_wpcom_device_disable_push_notifications_success Properties: is_jetpack_installed, is_jetpack_connected, is_jetpack_cp_connected, is_ciab, garden_partner.


4. Test wpcom_device_disable_push_notifications_error

Preconditions:

  • Fresh install or WPCOM device was never registered

Steps:

  1. Fresh install the app with feature flag enabled
  2. Login to a site with WooCommerce 10.4+
  3. Check logcat for the event.

Verify:
woocommerceandroid_wpcom_device_disable_push_notifications_error Properties: error_description ("Device not registered."), error_type ("UnregisteredDevice"), is_jetpack_installed, is_jetpack_connected, is_jetpack_cp_connected, is_ciab, garden_partner.


5. Test push_notification_received

Preconditions:

  • Push notifications enabled for the site
  • Push notification permissions granted

Steps:

  1. Login to a site with push notifications enabled.
  2. Trigger a notification (e.g., create a product review from another device/browser)
  3. Receive the push notification
  4. Check logcat for the event

Verify:
woocommerceandroid_push_notification_received Properties: is_jetpack_installed, is_jetpack_connected, is_jetpack_cp_connected, is_ciab, garden_partner


6. Test push_notification_tapped

Preconditions:

  • A push notification is displayed

Steps:

  1. Receive a push notification (see step 5)
  2. Tap on the notification
  3. Check logcat for the event

Verify:
woocommerceandroid_push_notification_tapped: Properties: is_jetpack_installed, is_jetpack_connected, is_jetpack_cp_connected, is_ciab, garden_partner

Images/gif

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@irfano irfano requested a review from JorgeMucientes January 22, 2026 19:52
@irfano irfano added category: tracks Related to analytics, including Tracks Events. feature: notifications Related to notifications or notifs. labels Jan 22, 2026
@dangermattic
Copy link
Collaborator

1 Error
🚫 PR is not assigned to a milestone.
1 Message
📖

This PR contains changes to Tracks-related logic. Please ensure (author and reviewer) the following are completed:

  • The tracks events must be validated in the Tracks system.
  • Verify the internal Tracks spreadsheet has also been updated.
  • Please consider registering any new events.
  • The PR must be assigned the category: tracks label.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App NameWooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit017ea6e
Direct Downloadwoocommerce-wear-prototype-build-pr15239-017ea6e.apk

@wpmobilebot
Copy link
Collaborator

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit017ea6e
Direct Downloadwoocommerce-prototype-build-pr15239-017ea6e.apk

@wpmobilebot
Copy link
Collaborator

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

Copy link
Contributor

@JorgeMucientes JorgeMucientes left a comment

Choose a reason for hiding this comment

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

Nicely done @irfano.
Tracking works as expected, however I left a suggestion that might be worth checking, as that would expand the support for common properties to the rest of the tracking events.
Also, it would be a nice opportunity to do some legacy properties clean up.

Comment on lines +61 to +64
this["is_jetpack_installed"] = site.isJetpackInstalled
this["is_jetpack_connected"] = site.isJetpackConnected
this["is_jetpack_cp_connected"] = site.isJetpackCPConnected
this["is_ciab"] = site.isCIABSite()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion.
I think we could set this properties in AnalyticsTracker.ktclass instead. In particular inbuildFinalProperties()function. This goes in line with what was suggeted in the P2 tracking plan comments. At the very least I'd addis_ciabandgarden_partnerthere. And while you are at it, remove the propertyfinalProperties[KEY_WAS_ECOMMERCE_TRIAL] = it.wasEcommerceTrial` from there. It doesn't make sense to track that anymore.

this["is_jetpack_connected"] = site.isJetpackConnected
this["is_jetpack_cp_connected"] = site.isJetpackCPConnected
this["is_ciab"] = site.isCIABSite()
site.gardenPartner?.let { this["garden_partner"] = it }
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't checked the API response yet, but in all my tests garde_partner was always null. I wonder if they have removed this field from the site model. I wouldn't be surprised tbh

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Labels

category: tracks Related to analytics, including Tracks Events. feature: notifications Related to notifications or notifs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants