question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rely strictly on AdSense API to determine account status

See original GitHub issue

Follow-up to #4758, #4759, #5106: The logic in the AdSense setup is now generally correct, however there is something we need to enhance: Currently, some of the states are determined based on the accountID and clientID settings, and there are a few situations where we don’t update them based on the current API responses. This can lead to inconsistent behavior, especially when mocking different statuses with the tester plugin.

It can certainly have real-world implications though too: for example if you first start the AdSense setup with an account that has an AFC client set up but then delete it, when you go back to the AdSense setup, Site Kit still has that old clientID set, which is incorrect and leads to the wrong status being set and the wrong UI showing up.


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

Acceptance criteria

  • In the AdSense V2 SetupMain component:
    • If there are no accounts in the API response, but accountID is set to a non-empty value, the setting should be updated to be an empty string again (in the respective useEffect).
  • In the AdSense V2 SetupAccount component:
    • If there is no AFC client in the API response, but clientID is set to a non-empty value, the setting should be updated to be an empty string again (in the respective useEffect).
    • Cleanup: The component should no longer use getClients which is unnecessary. That selector is internally used by getAFCClient, and its return value alone is sufficient for any of the conditions where the getClients result is currently used (e.g. loading state).

Implementation Brief

Test Coverage

  • N/A

QA Brief

For all tests below: Set the tester plugin AdSense site status to “ready”.

Ensure you have at least 1.8.2 of the Tester plugin installed.

Ensuring that account is reset

  • Set the tester plugin AdSense account status to “needs-attention”. Go to the AdSense setup (it should show the correct UI, but that’s not the point here).
  • Set the tester plugin AdSense account status to “none”. Go to the AdSense setup (it should show the correct UI as well, still not the thing to mostly look for).
  • Set the tester plugin AdSense account status to “multiple”. Go to the AdSense setup. You should now see the dropdown to select an account. If you land in another situation (where your account seems as if it was already selected), it would mean the problem was not fixed as expected.

Ensuring the client is reset

  • Set the tester plugin AdSense account status to “needs-attention”. Go to the AdSense setup (it should show the correct UI, but that’s not the point here).
  • Set the tester plugin AdSense account status to “no-client”. Go to the AdSense setup. You should now see the UI where it says that you need to upgrade your AdSense account to support “AdSense for Content”. If you land in another situation (where your client seems as if it was set), it would mean the problem was not fixed as expected.

Changelog entry

  • Ensure AdSense account ID and client ID are always set based on API response during setup.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
felixarntzcommented, May 12, 2022

@wpdarren Apologies, I think that small but crucial detail about the site status to set in the tester plugin was wrong the way I had originally specified it in the QA Brief. What you’re seeing is in fact expected because not having a site takes precedence over some of the other relevant criteria. So I’ve now updated the QA Brief to have the site status always set to “ready”, so that the site status cannot “conflict” with the account status you set here, which is what this issue is exclusively about.

1reaction
felixarntzcommented, May 11, 2022

@eugene-manuilov Replied on the PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Check the status of AdSense sites - Google Support
You can check the status of a site in your AdSense sites list. Learn how to sign in and check your AdSense site...
Read more >
May 2006 - Inside AdSense
The AdSense API is great for publishers who don't want the hassle of setting up their own accounts or dealing with cutting and...
Read more >
Upgrade Guide - Authorize.net Developer
Upgrade Guide. The items on this page represent API Implementations that are supported but no longer actively maintained or enhanced.
Read more >
Privacy & Terms - Google's policies
You can visit your Google Account to find and manage activity information ... and how long we store it depend in part on...
Read more >
White Paper on Information Quality and Content Moderation
To help us identify emerging harms and gaps in our existing policies, we consider expert input, user feedback, and regulatory guidance. We rely...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found