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

Encourage users to enable auto-updates for Site Kit #5853

Closed
aaemnnosttv opened this issue Sep 15, 2022 · 20 comments
Closed

Encourage users to enable auto-updates for Site Kit #5853

aaemnnosttv opened this issue Sep 15, 2022 · 20 comments
Labels
P1 Medium priority Rollover Issues which role over to the next sprint Type: Enhancement Improvement of an existing feature

Comments

@aaemnnosttv
Copy link
Collaborator

aaemnnosttv commented Sep 15, 2022

Feature Description

As a plugin which is very actively maintained and updated regularly, it makes sense to always keep Site Kit up to date on the latest version. While some users likely already have this enabled for Site Kit, this would be an easy thing we could encourage users to enable, e.g. right after activating the plugin in the success banner. This should help users to enjoy the latest features and fixes for Site Kit with less manual intervention on their part.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • If the new "Enable auto-updates" link is available on the Plugins page, show a Banner Notification on the Dashboard with a CTA pointing to the same link.
    • Title: Keep Site Kit up-to-date
    • Description: Turn on auto-updates so you always have the latest version of Site Kit. We constantly introduce new features to help you get the insights you need to be successful on the web.
    • Primary CTA: Enable auto-updates
    • Secondary Link: Dismiss
  • Show the banner only if the above link is available on the plugins page, i.e. at least the following conditions should be met:
  • For users who had already set up Site Kit, render the new Banner Notification if the above criteria is met on the next dashboard page load.
  • For users who have not set up Site Kit, render the new Banner Notification 10 minutes after the plugin was setup.
  • Clicking on the Primary CTA should call the same WordPress action which is triggered by the new "Enable auto-updates" toggle on the Plugins page. The notification should then be dismissed.
  • Clicking on the Secondary Link should dismiss the notification forever.

Implementation Brief

PHP part:

  • In order to check update_plugins capability a few new parameters should be passed to JS (to _googlesitekitBaseData) from WP:
    • Inside /includes/Core/Authentication/Authentication.php locate inline_js_base_data func and if WP version >= 5.5 add to $data following properties:
      • $data['updatePluginCapacity'] to be result of current_user_can( 'update_plugins' )
      • $data['autoUpdatesEnabled'] to be result of wp_is_auto_update_enabled_for_type( 'plugin' )

JS part:

  • Get new data from JS:

    • Inside datastore/site/info.js introduce new actions to get updatePluginCapacity and autoUpdatesEnabled from _googlesitekitBaseData:
      • getUpdatePluginCapacity: getSiteInfoProperty('updatePluginCapacity')
      • getAutoUpdatesEnabled: getSiteInfoProperty('autoUpdatesEnabled')
      • Check *getSiteInfo() in order to yield that data to actions
  • Create a new banner component:

    • Inside /assets/js/components/notifications create a new component (eg: EnableAutoUpdateBannerNotification)
      • Use BannerNotification component inside EnableAutoUpdateBannerNotification and configure it with title, description, and CTAs from AC
      • Configure BannerNotification with dismiss={ __( 'Dismiss', 'google-site-kit' ) }, isDismissable: true and expires: 0 in order to make it dismissable
      • Use select( CORE_SITE ).getUpdatePluginCapacity() to access updatePluginCapacity
      • Use select( CORE_SITE ).getAutoUpdatesEnabled() to access autoUpdatesEnabled
      • Use select( CORE_SITE ).wpVersion() to access WP version data
      • Use the above data to manage display logic for EnableAutoUpdateBannerNotification according to AC
      • Use apiFetch method POST to call wp-admin/admin-ajax.php with {action: toggle-auto-updates, state: enable, type: plugin, asset: google-site-kit/google-site-kit.php} in Primary CTA callback in order to enable auto-updates (same as on the plugins page in WP)
      • In order to ensure a delay for showing the notification after the initial setup (see Encourage users to enable auto-updates for Site Kit #5853 (comment)):
        • Check the condition for showing the initial setup notification by checking the query param notification=authentication_success is present while the query param slug is not present.
        • If these conditions are met, use setItem with a ttl of 600 seconds (10 minutes) to set a flag, and return null.
        • Otherwise, check if the flag is set with getItem, and if it's not set, return null.
  • Render EnableAutoUpdateBannerNotification inside /assets/js/components/notifications/BannerNotifications.js under SetupSuccessBannerNotification

Test Coverage

  • Cover EnableAutoUpdateBannerNotification with Jest tests
  • Add EnableAutoUpdateBannerNotification to react storybook
  • Add PHPUnit test coverage for the additions to Authentication.php

QA Brief

  • Verify the EnableAutoUpdateBannerNotification story in storybook looks as described.
  • On a existing Site Kit setup:
    • Go to Plugins /wp-admin/plugins.php, enable auto updates for Site Kit
    • Go to Site Kit Dashboard, Verify the auto update notification does not show up.
    • Go to Plugins /wp-admin/plugins.php, disable auto updates for Site Kit
    • Go to Site Kit Dashboard, Verify the new auto update notification shows up.
    • Click the Enable auto-updates CTA Button.
    • Verify banner text changes to a success notification with only a "Dismiss" button after clicking "Enable auto-updates"
    • Click "Dismiss"
    • Verify the Banner disappeares
    • Go to Plugins /wp-admin/plugins.php, verify the auto-updates are enabled for Site Kit.
  • On an new Site:
    • Flush your session storage to make sure, the previous tests do not affect the next test.
    • Make sure auto updates are disabled.
    • Setup Site Kit
    • After being redirected from Site Kit Service to Site Kit Dashboard, make sure the new notification Banner does not show up.
    • Flush your session storage, reload Site Kit Dashboard. Verify the auto update banner shows up again.
    • Install one of the "disable plugin auto updates" plugin to disable auto updates for plugins. Verify the auto updates notification does not show up when plugin auto updates are disabled.

Changelog entry

  • Add notification to prompt users to enable auto-updates.
@aaemnnosttv aaemnnosttv added Type: Enhancement Improvement of an existing feature Team Review Issue needs to be reviewed by team for triaging labels Sep 15, 2022
@aaemnnosttv aaemnnosttv self-assigned this Sep 15, 2022
@aaemnnosttv aaemnnosttv added P1 Medium priority and removed Team Review Issue needs to be reviewed by team for triaging labels Sep 21, 2022
@jimmymadon
Copy link
Collaborator

@aaemnnosttv Have added some preliminary ACs here based on our discussion. The notification text, time after setup to display the notification and whether to re-show the notification after dismissal need to be finalised.

c.c. @marrrmarrr @felixarntz

@aaemnnosttv
Copy link
Collaborator Author

Thanks @jimmymadon – this is almost there I think; a few points to iterate on:

"SiteKit" -> "Site Kit" 😉

On versions of WordPress where the new "Enable auto-updates" link is available

Let's mention the specific minimum version of WP we need for this. Also, we should only prompt users who have the necessary core capability to make this change as well.


Apart from that, I wonder if a dashboard notification is the best form for this. Maybe we should add it to the splash page next to the telemetry opt-in? Thoughts @marrrmarrr ?

@jimmymadon
Copy link
Collaborator

@aaemnnosttv Dug a bit deeper into this one and have updated the ACs with links to relevant docs.

The only purpose of keeping this a Banner Notification is that we want to show this to older users who have already connected/set up Site Kit. Maybe we can add a delay for new users (similar to the delay in the new TwG Supporter Wall widget prompt notification) so they don't get multiple stacked notifications after setup which can be overwhelming.

@jimmymadon jimmymadon removed their assignment Oct 3, 2022
@aaemnnosttv
Copy link
Collaborator Author

Thanks @jimmymadon

  • The Banner Notification should be shown <x time?> after setting up the plugin.

I don't think we need to add a particular delay to it. User's already won't see it as the main thing after connecting immediately as there would be other higher-priority banners they would see – at least the success/congrats banner.

Why not also add a CTA to the ActivationNotice? The user should have just activated the plugin so it would be a reasonable time to suggest it I think. I'm not saying instead of the banner here, but as an additional message.

  • Clicking on the Secondary Link will dismiss the notification <forever?>.

Yes, we shouldn't nag them on a regular basis about it. It's just a nice to have 👍

We constantly introduce new features to help you get the insights you need to be successful on the web.

We can always revise the wording while we're in motion, just thinking this could be simplified a little bit. Perhaps:
We're constantly adding new features and fixes to help you be successful on the web.

Apart from that, I feel like there might be a little more we need to consider after reviewing the intro blog post you shared. I.e. users could have auto-updates enabled for all plugins ("Blanket auto-update opt-in") or interface elements disabled. The AC can be a bit loose about this as high level criteria but we should be sure this is covered in the IB so it might be worth noting somewhere.

@jimmymadon
Copy link
Collaborator

@aaemnnosttv Thanks for clarifying some of those questions.

Why not also add a CTA to the ActivationNotice? The user should have just activated the plugin so it would be a reasonable time to suggest it I think. I'm not saying instead of the banner here, but as an additional message.

Did you mean to add a Primary CTA button to SetupSuccessBannerNotification (instead of the Got it!) dismiss button? If so, we will have to change the script of this banner notification. Also, we will have to remove the Got it! dismiss button to Maybe Later and clicking on it would mean not showing the new Auto-update Banner Notification. Flow-wise, this is better as it reduces one banner notification/click for newly setup users. Implementation-wise, this is slightly more complicated.

@jimmymadon jimmymadon assigned aaemnnosttv and unassigned jimmymadon Oct 19, 2022
@aaemnnosttv
Copy link
Collaborator Author

Did you mean to add a Primary CTA button to SetupSuccessBannerNotification (instead of the Got it!) dismiss button? If so, we will have to change the script of this banner notification.

Ah no, I meant as part of ActivationApp which shows on the plugins page after activating.

@jimmymadon
Copy link
Collaborator

@marrrmarrr @felixarntz In @aaemnnosttv's absence, could one of you please have a look if the ACs here look alright? Have incorporated all of Evan's suggestions and our review of this issue a while back. Thanks!

@jimmymadon
Copy link
Collaborator

@aaemnnosttv Based on our AC sync today, we decided to make this as simple as possible and only stick to creating the banner which would be shown soon after someone activates and sets up the plugin. I have created another issue #6092 for modifying the ActivationApp notice.

@felixarntz
Copy link
Member

@aaemnnosttv @jimmymadon Adding to the above that the same banner should be used for existing users. It shouldn't show right away when having completed the initial setup flow, but any time after, e.g. a few minutes later or so. For users that already had configured the plugin, it can show at any point.

@sashadoes sashadoes self-assigned this Nov 1, 2022
@jimmymadon
Copy link
Collaborator

@felixarntz I am guessing your issue with showing the banner immediately after setup is that there will potentially be three banners back-to-back after setup (SetupSuccessBannerNotification, ZeroData and the EnableAutoUpdates)? In that case, should we explore adding a CTA to the SetupSuccessBannerNotification and only show the new banner to existing users? The alternative as you suggest is creating a time delay but that will involve yet another transient.

@aaemnnosttv
Copy link
Collaborator Author

@jimmymadon I think we can use a client-side cache value to manage the delay as it's a rather short duration. I imagine this could work similar to how we handle the feature tour cooldown.

@sashadoes sashadoes removed their assignment Nov 16, 2022
@wpdarren
Copy link
Collaborator

wpdarren commented Jan 23, 2023

QA Update: ✅

On a existing Site Kit setup:

  • Enabling auto updates for Site Kit, the auto update notification does not show up.
  • Disabling auto updates for Site Kit, the new auto update notification shows up.
  • Clicking the Enable auto-updates CTA Button, the banner text changes to a success notification with only a "Dismiss" button after clicking "Enable auto-updates"
  • Clicking "Dismiss" the Banner disappears.
  • Confirmed the auto-updates are enabled for Site Kit.

On an new Site:

  • When auto updates are disabled and Site Kit is setup.
    • After being redirected from Site Kit Service to Site Kit Dashboard, the new notification banner does not show up.
    • After flushing session storage, reload Site Kit Dashboard, the auto update banner shows up again.
  • When I activated the plugin to disable auto update, the auto updates notification does not show up when plugin auto updates are disabled.

Additional QA: Tested the above for a multisite and the checks above pass. The banner appears on the multisites when auto updates is disabled.

Screencasts
upd-1.mp4
upd-2.mp4
upd-3.mp4

image
image

QA notes for future reference:

For InstaWp sites the auto updates are disabled by default so you have to alter code in the wp-config file. Search for define( 'AUTOMATIC_UPDATER_DISABLED', true ); and change it to define( 'AUTOMATIC_UPDATER_DISABLED', false ); so that the options appear in the plugins page to enable/disable auto updates.

The plugin I used to disable auto update was Disable All WordPress Updates which can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 Medium priority Rollover Issues which role over to the next sprint Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests