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

Empty Stats: Add event tracking for Publicize / Blogging Reminders #17313

Merged
merged 15 commits into from
Oct 15, 2021

Conversation

momo-ozawa
Copy link
Contributor

@momo-ozawa momo-ozawa commented Oct 13, 2021

Part of #17307

Description

This PR adds event tracking for the following events:

// Stats - Empty Stats nudges

stats_publicize_nudge_shown
stats_publicize_nudge_tapped
stats_publicize_nudge_dismissed
stats_publicize_nudge_completed
stats_blogging_reminders_nudge_shown
stats_blogging_reminders_nudge_tapped
stats_blogging_reminders_nudge_dismissed
stats_blogging_reminders_nudge_completed

// Stats - Customize card

stats_customize_insights_shown

To test

To review this PR, please do the following:

  1. Make sure events fire correctly by following the trigger in the table below
  2. Validate the events (PCYsg-ktp-p2)

What does it mean for an event to be valid?

An event can be marked valid when you’ve checked that it:

Fires when it’s supposed to.
Fires exactly once each time it’s supposed to fire.
Has a blogid set if the event takes place in a site context.  If it’s not in a site context (e.g. a landing page or the wpcom homepage), you can omit a blogid.
Has the event properties that you intend it to have, and that are being attached to the event by your code.

Who should review it?

Similarly to code reviews, someone on your team or working in the same area as you is probably best to review your event.

Event table

Event Trigger blog_id?
stats_publicize_nudge_shown Publicize card is shown upon visiting the Stats Insights screen
stats_publicize_nudge_tapped Tapping on the Enable post sharing button on the Publicize card
stats_publicize_nudge_dismissed Tapping on the Dismiss button on the Publicize card
stats_publicize_nudge_completed Successfully setting up at least one connection via Publicize
stats_blogging_reminders_nudge_shown Blogging Reminders card is shown upon visiting the Stats Insights screen
stats_blogging_reminders_nudge_tapped Tapping on the Set up blogging reminders button on the Blogging Reminders card
stats_blogging_reminders_nudge_dismissed Tapping on the Dismiss button on the Blogging Reminders card
stats_blogging_reminders_nudge_completed Successfully setting up Blogging Reminders via the Blogging Reminders flow
stats_customize_insights_shown Customize Insights card is shown upon visiting the Stats Insights screen

Regression Notes

  1. Potential unintended areas of impact
    N/A

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    Manually tested and made sure events fire properly with the correct triggers / properties

  3. What automated tests I added (or what prevented me from doing so)
    N/A

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@momo-ozawa momo-ozawa added this to the Someday milestone Oct 13, 2021
@momo-ozawa momo-ozawa self-assigned this Oct 13, 2021
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Oct 13, 2021

You can trigger an installable build for these changes by visiting CircleCI here.

@momo-ozawa momo-ozawa force-pushed the task/empty-stats-events branch from 27648b0 to 82f9684 Compare October 14, 2021 09:57
@momo-ozawa
Copy link
Contributor Author

momo-ozawa commented Oct 14, 2021

Notes

  • I'll add the nudge_dismissed events after Nikola's fix presentation logic PR lands. The plan is to track the events in the individual dismiss nudge methods for SiteStatsInsightsDelegate -> ✅

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Oct 14, 2021

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@momo-ozawa momo-ozawa force-pushed the task/empty-stats-events branch from 60a3d9d to b4fb243 Compare October 15, 2021 09:18
@momo-ozawa momo-ozawa marked this pull request as ready for review October 15, 2021 09:33
@momo-ozawa
Copy link
Contributor Author

Reverted b4fb243 because it was causing the presentation logic to break.
Added a workaround in c74d496 to make sure the shown events are fired only once.

Copy link
Contributor

@nikola-milicevic nikola-milicevic left a comment

Choose a reason for hiding this comment

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

Great work!
Since you've already cleaned up some of my code 😄 could you just please get rid of nil coalescing operator here?
And case let syntax would be great here as well! (so I don't have to do this)

I have just two concerns:

  • stats_blogging_reminders_nudge_shown wasn't triggered for me 😬, I will check again (few times)
  • didChangePublicizeServices method of SharingViewControllerDelegate could fire even if there are no changes (but that's not the scope of this PR - just pointing out here)

case is GrowAudienceCell.HintType where !insightsToShow.contains(.growAudience):
case let hintType as GrowAudienceCell.HintType where !insightsToShow.contains(.growAudience):
Copy link
Contributor

Choose a reason for hiding this comment

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

👌

Copy link
Contributor

@leandroalonso leandroalonso left a comment

Choose a reason for hiding this comment

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

@momo-ozawa it worked just fine for all the described events, except for the blogging reminders nudge appearing. No events are fired at all.

At least here, inside loadPinnedCards the execution is hitting the break. Let me know if you need more info!

case InsightType.customize where !insightsToShow.contains(.customize):
insightsToShow = insightsToShow.filter { $0 != .growAudience }
insightsToShow.insert(.customize, at: 0)

// Work around to make sure customize insights shown is tracked only once
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this to prevent the event from being fired multiple times?

if that's the case, this is something we should not be worried about, given that normally we look at "unique" events.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, this is a workaround to make sure the correct event will be fired once.

If you go to a site with more than 30 views (i.e. customize should be showing) and comment out the if viewsCount != nilstatement, you'll see that the publicize_nudge_shown event is fired right before the correct event, customize_insights_shown.

I tried doing b4fb243 in an attempt to fix this behavior, but that actually ended up breaking the presentation logic. (after dismissing a card, the next card shown would be the incorrect card, etc.) Maybe @nikola-milicevic has some insight on how to address this issue without breaking the presentation logic?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh ok! If that's the case then don't worry. Just wanted to make sure.

Copy link
Contributor

@nikola-milicevic nikola-milicevic left a comment

Choose a reason for hiding this comment

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

stats_blogging_reminders_nudge_shown wasn't triggered for me 😬, I will check again (few times)

Checked again, few times, all good 😊
Not sure what happened.

@leandroalonso
Copy link
Contributor

stats_blogging_reminders_nudge_shown wasn't triggered for me 😬, I will check again (few times)

I have the same issue 😬

@leandroalonso
Copy link
Contributor

FYI:

Screen Shot 2021-10-15 at 09 16 52

@momo-ozawa
Copy link
Contributor Author

@momo-ozawa it worked just fine for all the described events, except for the blogging reminders nudge appearing. No events are fired at all.

At least here, inside loadPinnedCards the execution is hitting the break. Let me know if you need more info!

🤯 Hmmmm. Looking into this. So weird -- in your screenshot item evaluates to .bloggingReminders, which should be caught by the case let hintType as GrowAudienceCell.HintType... statement. Hmmmmm.

Momo Ozawa added 2 commits October 15, 2021 16:05
This fixes an issue where the following condition was failing:

where !insightsToShow.contains(.growAudience)
@momo-ozawa
Copy link
Contributor Author

@leandroalonso @nikola-milicevic
Ready for a re-review! The mysterious bug where blogging_reminders_nudge_shown wasn't being fired has been fixed!
94d4b9e

Copy link
Contributor

@leandroalonso leandroalonso left a comment

Choose a reason for hiding this comment

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

@momo-ozawa :shipit:

I also validated all the events.

@momo-ozawa momo-ozawa merged commit 9efabd9 into feature/empty-stats-phase-1 Oct 15, 2021
@momo-ozawa momo-ozawa deleted the task/empty-stats-events branch October 15, 2021 15:31
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.

3 participants