Skip to content

Conversation

@anikiki
Copy link
Contributor

@anikiki anikiki commented Dec 5, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/project/1200581511062568/task/1211783737656685?focus=true

Description

Added pixel tracking for CardsList remote messages. This PR introduces a new CardsListRemoteMessagePixelHelper class that handles firing pixels for card-specific events (shown, clicked, dismissed) with appropriate parameters. The implementation tracks when cards are shown to users, when users interact with cards, and how messages are dismissed.

Steps to test this PR

CardsList Remote Message Tracking

  • Verify that when a CardsList message is shown, the m_remote_message_card_shown pixel fires for each card
  • Verify that when a card item is clicked, the m_remote_message_card_clicked pixel fires with the correct card ID
  • Verify that when a message is dismissed via close button or via the back navigation, the m_remote_message_dismissed pixel fires with the appropriate dismiss type parameter
  • Verify the other existing RMF pixels are fired (message shown, primary action clicked)

NO UI changes


Note

Add pixel tracking for CardsList remote messages (card shown/clicked, dismiss with type) and integrate firing on show, click, and back/close flows with tests.

  • Remote Messaging (CardsList):
    • Pixel definitions: Add RMF definitions including m_remote_message_card_shown, m_remote_message_card_clicked, and dismiss_type for m_remote_message_dismissed in PixelDefinitions/pixels/remote_messaging_framework.json5.
    • Helper: Introduce CardsListRemoteMessagePixelHelper with RealCardsListRemoteMessagePixelHelper to fire card_shown, card_clicked, and dismissed (with custom params) and dismiss via RemoteMessagingRepository.
    • ViewModel integration:
      • CardsListRemoteMessageViewModel: track current RemoteMessage; on render call onMessageShown() to fire m_remote_message_shown via RemoteMessageModel and per-card m_remote_message_card_shown; fire m_remote_message_card_clicked on item click; on close, fire m_remote_message_dismissed with dismiss_type="close_button".
      • ModalSurfaceViewModel + ModalSurfaceActivity: handle back navigation to fire m_remote_message_dismissed with dismiss_type="back_button_or_gesture" and dismiss.
    • UI hook: CardsListRemoteMessageView calls viewModel.onMessageShown() when content is rendered.
  • Tests:
    • Add unit tests for helper, CardsList VM, and ModalSurface VM covering card shown/clicked pixels, primary action, and dismiss with correct dismiss_type.

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

Copy link
Contributor Author

anikiki commented Dec 5, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@anikiki anikiki changed the title Add CardsListRemoteMessagePixelHelper for pixel tracking of card interactions. [Android] "What’s New" promo message: Implement pixels Dec 5, 2025
@anikiki anikiki marked this pull request as ready for review December 5, 2025 17:32
@anikiki anikiki requested a review from cmonfortep December 5, 2025 17:32
companion object {
private const val PARAM_NAME_MESSAGE_ID = "message"
private const val PARAM_NAME_CARD_ID = "card"
internal const val PARAM_NAME_DISMISS_TYPE = "dismissType"
Copy link

Choose a reason for hiding this comment

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

Bug: Pixel parameter name mismatch with JSON5 definition

The constant PARAM_NAME_DISMISS_TYPE is defined as "dismissType" (camelCase), but the pixel definition in remote_messaging_framework.json5 specifies the parameter key as "dismiss_type" (snake_case). This mismatch will cause the dismiss type parameter to not be properly recognized by the analytics system, resulting in anonymous measurement data being lost or incorrectly categorized.


Please tell me if this was useful or not with a 👍 or 👎.

Fix in Cursor Fix in Web

binding.headerImage.setImageResource(it.placeholder.drawable(true))
binding.headerTitle.text = it.titleText
binding.actionButton.text = it.primaryActionText
viewModel.onMessageShown()
Copy link

Choose a reason for hiding this comment

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

Bug: Missing duplicate prevention for "shown" pixels

The onMessageShown() call in render() lacks the duplicate prevention check present in the existing RemoteMessageView. The ViewModel computes newMessage (line 70) but doesn't include it in ViewState or use it to guard pixel firing. In contrast, the existing RemoteMessageView uses shouldRender = newMessage || binding.root.visibility == View.GONE before calling onMessageShown(). Without this check, the card "shown" pixels will fire every time render() is called with the same message, such as after configuration changes, leading to duplicate anonymous measurement data.


Please tell me if this was useful or not with a 👍 or 👎.

Additional Locations (1)

Fix in Cursor Fix in Web

@anikiki anikiki force-pushed the feature/ana/android_whats_new_promo_message_add_the_new_ui_elements branch from ff64a45 to 1957d95 Compare December 8, 2025 23:31
@anikiki anikiki force-pushed the feature/ana/android_whats_new_promo_message_implement_pixels branch 2 times, most recently from 73d3d60 to 579c0e6 Compare December 9, 2025 18:02
@anikiki anikiki force-pushed the feature/ana/android_whats_new_promo_message_add_the_new_ui_elements branch from f56fe00 to a2f7db4 Compare December 9, 2025 18:05
@anikiki anikiki force-pushed the feature/ana/android_whats_new_promo_message_implement_pixels branch from 579c0e6 to 9a50672 Compare December 9, 2025 18:05
val customParams = mapOf(
PARAM_NAME_DISMISS_TYPE to PARAM_VALUE_CLOSE_BUTTON,
)
cardsListPixelHelper.dismissCardsListMessage(message.id, customParams)
Copy link

Choose a reason for hiding this comment

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

Bug: Dismiss command sent before pixel and repository operations

In onCloseButtonClicked(), the Command.DismissMessage is sent before cardsListPixelHelper.dismissCardsListMessage() is called. This could cause a race condition where the activity finishes before the pixel fires and the message is dismissed in the repository. Compare with onBackPressed() in ModalSurfaceViewModel which correctly calls dismissCardsListMessage() first and sends the dismiss command afterward. The inconsistent ordering in onCloseButtonClicked() could result in missed anonymous measurements and messages not being properly marked as dismissed.


Please tell me if this was useful or not with a 👍 or 👎.

Fix in Cursor Fix in Web

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.

2 participants