-
Notifications
You must be signed in to change notification settings - Fork 293
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
Upgrade legacy AdSense account and site statuses #5628
Comments
@aaemnnosttv Is this about sites which already have AdSense connected? Since for sites that still have to go through finishing the setup, I think the statuses should update to the new ones by itself. Regarding sites with AdSense already connected, this is a tricky one. Of course, one thing we could do is just display the corresponding new "approved/ready/connected" account status and site status for those sites and hope that everything is fine. Or, another approach that would take more effort could be something like this:
cc @marrrmarrr |
@felixarntz, yes this is about updating saved v1 statuses in the AdSense settings. Not sure if sites that aren't connected yet would benefit from this or not but connected sites would primarily benefit since these would have been set up (potentially years ago) and then not touched. I wasn't thinking we'd do anything in response to report data. Instead, I think we could do the migration on-the-fly, perhaps in the settings-view and settings-edit components. If a v1-specific status is detected, we'd run the necessary queries to "upgrade" the status to determine the current v2 status that we're already doing in module setup. It could probably be a bit simpler as the accountID would already be known. As an aside, it might be worth thinking about explicitly versioning the schema in the settings in the future. |
@aaemnnosttv For not connected sites that still have to go through module setup, this is no problem anyway as the new status will be detected as soon as they open the module setup again. So migration is only relevant for sites where AdSense is already connected. However, the problem is that the v1 "connected" statuses for the account and site are too generic and inaccurate to map 1:1 to a v2 status, since in v1 we didn't know a whole lot of things which in v2 are now setup-blocking. We could run the queries like you're saying, but that could lead to the module being not connected anymore when it was connected before. That may be fine, but I think it would be an unexpected user experience to suddenly have the module no longer connected without having done anything. That's why in my previous comment I suggested to do it only on demand if the report is empty, but most importantly invoked by the user explicitly with a button like I mentioned there. |
@felixarntz thinking about this a bit more, the connected state is based on the Alternatively, we should be able to safely migrate all the v1-only statuses without affecting the connected state of the module as that is determined by settings which are independent from those statuses. Then, if we later detected a mismatch (i.e. non- What do you think? |
@marrrmarrr I discussed the approach here earlier today with @aaemnnosttv, and we aligned on what would be the best way to migrate users that are still on V1 statuses. I've captured the plan in the ACs, pending the exact wording for the notice we're envisioning. Please have a look, though it may be helpful to talk through this in person for more context. |
@felixarntz I added suggested wording, PTAL and if it LGTY, let's go with this. |
Hi @felixarntz and @aaemnnosttv following Mariya's update are we good to get this moved to IB? Thanks! |
I'm still not quite so familiar with the AdSense code yet, so I had to dig into this one. Looks good to me, nice work @kuasha420! There's just one point that I think could do with a little clarification:
Looking at the following, I'm guessing this means that if the status is in one of the sets of constants which is marked as site-kit-wp/assets/js/modules/adsense/util/status.js Lines 19 to 47 in 0eb9173
|
@techanvil solid suggestion, I've added this point to the IB. Cheers. |
Thanks @kuasha420! IB ✅ |
@wpdarren Thank you for your detailed QA report here. The first issue is not due to the changes made here but how the feature flags interact with each other. You need to set "Always Override" in the Tester Plugin and then enable For the second issue, it's a mistake in the code and I'll create a follow up PR fixing this momentarily. Cheers! |
Back to you @wpdarren for another pass 👍 |
@wpdarren @aaemnnosttv There's another oversight in the newly created As a result,
Silly mistake on my part as I wasn't fully familiar with the AdSense(V2) setup flow when I wrote the initial IB. I only caught this while working for an Ad Blocker Detection IB. I'll pull this one back from QA and open another follow up PR to address this. Cheers. |
QA Update:
|
QA Update: ❌@kuasha420 thank you for your help testing this. I was able to trigger the new UI with another Google account. I have a few observations.
adsense-1.mp4
|
@wpdarren Thanks for your diligence here. I've addressed all 3 of your concern in the follow up PR. Cheers. |
QA Update: ✅Verified:
|
Feature Description
With the new and improved AdSense v2 setup flow, we're able to display more accurate information on a user's AdSense account and site statuses. Since #5503 this has been surfaced in the settings as well.
However, users who set up AdSense before the v2 setup flow was released will still have the older statuses in the module settings which prevent us from showing more accurate information about the current state.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
adsenseSetupV2
flag is enabled but theaccountStatus
orsiteStatus
settings use one of the legacy (V1) statuses, a new component should be included on top of the widget body (i.e. within theWidget
component, but before theOverview
component).accountID
.state
value, and based on both of these determine whether theaccountStatus
isready
or something else, basically a subset of how the V2SetupAccount
component does it.state
andautoAdsEnabled
values, and based on both of these determine whether thesiteStatus
isready
or something else, basically a subset of how the V2SetupAccountSite
component does.accountStatus
andsiteStatus
result inready
, the two module settings should be updated on the fly, and the component should simply returnnull
(render nothing). Otherwise, it should not update the module settings, but render the following:accountSetupComplete
andsiteSetupComplete
flags tofalse
.Implementation Brief
StatusMigration
function component.accountID
,afcClient
,site
andadminReauthURL
usinggetAccountID
,getAFCClient
,getCurrentSite
andgetAdminReauthURL
selectors ofMODULES_ADSENSE
store.READY
state using the following.afcClient
orsite
isundefined
, setisReady
asundefined
.afcClient.state !== API_STATE_READY
,site.state !== API_STATE_READY
or,! site.autoAdsEnabled
, setisReady
asfalse
.isReady
istrue
.isReady
changes:isReady
is false-y, do nothing and return early.accountStatus
andsiteStatus
toACCOUNT_STATUS_READY
andSITE_STATUS_READY
usingsetAccountStatus
andsetSiteStatus
actions ofMODULES_ADSENSE
store.null
from the component ifisReady
isundefined
ortrue
.SettingsNotice
andButton
.accountSetupComplete
andsiteSetupComplete
flags to false usingsetAccountSetupComplete
andsetSiteSetupComplete
actions.navigateTo
action of theCORE_LOCATION
store withadminReauthURL
url.assets/js/modules/adsense/util/status.js
:isLegacyAccountStatus
andisLegacySiteStatus
that returnstrue
whenever passed{account|site}Status
argument is one of the v1{account|site}
status. See here and check for the v1-only status.assets/js/modules/adsense/components/module/ModuleOverviewWidget/index.js
:accountStatus
andsiteStatus
usinggetAccountStatus
andgetSiteStatus
selectors ofMODULES_ADSENSE
store.accountStatus
andsiteStatus
are legacy.adsenseSetupV2Enabled
istrue
and eitherstatus
is legacy, render theStatusMigration
component above theOverview
component.Test Coverage
QA Brief
adsenseSetupV2
feature flag.adsenseSetupV2
feature flag and go to monetization of the dashboard.READY
, there should be no additional UI and the status will get migrated toready
for both on the fly (wait a few sec before running the snippets above to check.)Changelog entry
The text was updated successfully, but these errors were encountered: