Skip to content

Conversation

@joshheald
Copy link
Contributor

@joshheald joshheald commented Nov 1, 2022

Closes: #7854

Description

We've added the ability to show a Just In Time Message at the top of the dashboard in #7853. Just In Time Messages can be dismissed; when they are, that should be communicated back to Jetpack via the REST API, and the dismissal is noted there.

After a message has been dismissed, the rules for whether it should be displayed will take that in to account. The message can have a number of dismissals defined, and a duration between those dismissals. By default, after being dismissed a message will be shown again six weeks later, and if it's dismissed a second time, it won't be shown again.

This PR implements the dismiss behaviour and analytics on our JITM.

Testing instructions

N.B. see pdfdoF-1uc-p2#comment-2581 for details of setting up your store to be eligible for the test JITM

The test JITM uses unrealistic dismissal rules to make testing easier. There are 1000 dismissals possible, and the dismissal only lasts 30 seconds. With this JITM it's not really possible to check that the JITM isn't shown again after the dismissal limit is reached, but that isn't the app's responsibility. We can test this once we make the JITM production-ready and set the dismissal limit to a sensible value.

With a US store that is eligible for the test JITM, on a debug/alpha build of the app

Dismissal request is sent

  1. Set up Proxyman or Charles to observe network requests
  2. Open the app
  3. Observe that the message is shown
  4. Tap the x
  5. Observe that the message is removed
  6. Observe in Proxyman/Charles that a POST request has been made to the correct store ID with the following payload:
body={"feature_class":"woomobile_ipp","id":"woomobile_ipp_barcode_users"}
json=true
path=/jetpack/v4/jitm&_method=post

Dismissal is effective

  1. Repeat the above steps up to 5
  2. Quit and relaunch the app by flicking it out of the app switcher, within 30 seconds of dismissing
  3. Observe that the message is not shown
  4. Quit and relaunch again after 30s has passed
  5. Observe that the message is shown again.

Analytics

  1. Repeat the steps to dismiss the JITM
  2. Observe in the debug output that the woocommerceios_jitm_dismiss_success and woocommerceios_jitm_dismissed events are tracked with the following properties:
  • *_jitm_dismissed event with props jitm_group: woomobile_ipp, jitm_id: woomobile_ipp_barcode_users, source: my_store
  • Track *_jitm_dismiss_success event with props jitm_group: woomobile_ipp, jitm_id: woomobile_ipp_barcode_users, source: my_store
  1. Set up Proxyman or Charles with a breakpoint on https://public-api.wordpress.com/rest/v1.1/jetpack-blogs/{siteid}/rest-api/, for POST requests only.
  2. Repeat the steps to dismiss the JITM
  3. When you reach your Proxyman/Charles breakpoint, abort the request
  4. Observe that the failure event below is tracked correctly.
  • *_jitm_dismiss_failure event with props jitm_group: woomobile_ipp, jitm_id: woomobile_ipp_barcode_users, source: my_store and error props

Screenshots

Analytics debug print output

dismiss-jitm.mp4

Dismissed event in Tracks live view

Dismiss success event in Tracks live view

Dismiss failure event in Tracks live view


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@joshheald joshheald added type: task An internally driven task. category: tracks Related to analytics, including Tracks Events. feature: jitm Related to Just In Time Messages labels Nov 1, 2022
@joshheald joshheald added this to the 11.1 milestone Nov 1, 2022
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 1, 2022

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr8001-bbbbcae on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@joshheald joshheald requested review from pachlava and toupper November 1, 2022 18:01
@joshheald joshheald marked this pull request as ready for review November 1, 2022 18:01
@joshheald
Copy link
Contributor Author

joshheald commented Nov 2, 2022

@rachelmcr FYI this implements dismissal on the announcements. Adding you as an optional reviewer because it'll affect the product onboarding too.

This change, to nil the announcement view model when the x is tapped, will make the announcements disappear. I'll animate it a bit later.

See the implementation in dontShowAgainTapped for how we're logging analytics after the network request returns: you may need to do something similar in your view model, if it happens after the vm is set to nil.

@joshheald joshheald requested a review from rachelmcr November 2, 2022 09:28
Copy link
Contributor

@pachlava pachlava left a comment

Choose a reason for hiding this comment

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

@joshheald 👋

Thanks for such detailed testing instructions! It all worked for me exactly as you describe, and I noticed nothing suspicious. I've tested this with iPhone 14 Sim, both successful dismissal and making it to fail (via breakpoint and via breaking the Internet connection).

Having the JITM dismissal fail resulted in JITM banner be shown right after relaunch, which I suppose is the correct behaviour.

@toupper toupper self-assigned this Nov 2, 2022
let action = JustInTimeMessageAction.dismissMessage(justInTimeMessage,
siteID: siteID,
completion: { result in
// We deliberately strongly capture self here: the owning reference to the VM may have been
Copy link
Contributor

Choose a reason for hiding this comment

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

Good addition of this explanatory comment 👍

@toupper
Copy link
Contributor

toupper commented Nov 2, 2022

Code looks great! :shipit:

Base automatically changed from issue/7855-utm-params-and-analytics-on-JITM-cta to trunk November 2, 2022 11:33
@peril-woocommerce
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 2 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@joshheald joshheald merged commit 850f506 into trunk Nov 2, 2022
@joshheald joshheald deleted the issue/7854-delete-jitm branch November 2, 2022 11:35
@rachelmcr
Copy link
Contributor

@rachelmcr FYI this implements dismissal on the announcements. Adding you as an optional reviewer because it'll affect the product onboarding too.

Thanks for the heads up! The current products onboarding experience doesn't include a dismiss button (ref: pe5pgL-11B-p2#comment-1004) so for now the only way to dismiss it is by tapping the CTA/adding a product. So we're good in terms of dismissing announcements. 👍 We'll keep this in mind in case we need to add back that button, though!

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: jitm Related to Just In Time Messages type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Just In Time Messages] Dismiss JITM when x tapped

6 participants