google / google/site-kit-wp

Ensure AdSense widgets only show "Gathering data" box when API is actually gathering data

Open
#4,087 6 comments 0 reactions 0 assignees View on GitHub
Module: AdSense P1 Type: Enhancement
Dominant language
JavaScript
Stars
1.4k
Forks
383
Avg merge
4d 14h
Merged PRs (30d)
77

Description

Currently, Site Kit widgets are configured to show the "AdSense gathering data" box whenever the API returns a response with all 0s. This is somewhat confusing and an incorrect approach, since it could also mean that the site actually has 0 data, even though data is already being aggregated properly.

This should be adjusted, and the "AdSense gathering data" box should only be shown for 0 data if the API is actually _likely_ gathering data - _likely_ since this needs to be based on heuristics as there is no API flag that clearly states whether or not data is now ready to be served.

Related: #4085, #4086

---------------

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

## Acceptance criteria

* AdSense should store a new `propertyCreated` sub-setting upon plugin setup. It should be a timestamp that comes from the `createTime` field in the `accounts.get` response (see https://developers.google.com/adsense/management/reference/rest/v2/accounts#Account).
* The setting should also be set anytime the current account ID is changed (rare but possible).
* The AdSense property should be considered "new" if the timestamp is less than 3 days old.
* If the value isn't set (all existing sites), the AdSense property should not be considered "new".
* All AdSense widgets should, in case that it would currently display the "zero data" UI, also check if at least one of either the site (using the new function introduced in #4085) or the AdSense property are "new" - only if that's the case, the widget should display the "zero data" UI. Otherwise it should display the regular widget content, actually "showing the 0s".

## Implementation Brief

*

### Test Coverage

*

## QA Brief

*

## Changelog entry

*

Contributor guide

Open the contributing guide

Research direction

Start at the AdSense accounts.get response and the existing zero-data widget checks, then inspect the site-new function introduced in #4085. Done means propertyCreated is stored from createTime on setup and account changes, and zero-data UI appears only when the site or property is less than 3 days old.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
full-stack
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.