Subdomain cannot complete AdSense connection.

[ad_1]

Site Kit > settings > AdSense shows “Complete setup for AdSense” recently. But I had done it before.

But now, when I click the “Complete setup for AdSense” button, it will turns to a progress page for a while, and shows error “Invalid site state null”.

I thought the “state null” means my site. But tools > Site Health shows everything is OK

When I check network console, I found the “/wp-json/google-site-kit/v1/modules/adsense/data/sites?accountID=pub-xxxxxxxxxxxxx&_locale=user” API will get all domains that I setted in AdSense before. It will also includes all subdomains.

But, the new version of AdSense “Sites” page has no subdomain managements.

In this data that api returned, all subdomains are autoAdsEnabled: null, state: null.

I guess that’s why I can’t verify.

So, I edit “google-site-kit/third-party/google/apiclient-services/src/Adsense/ListSitesResponse.php”, give autoAdsEnabled: true, state: ‘READY’. Finally it passed!

I think Site Kit should not using subdomain to verify. Because the new version of AdSense “Sites” already remove subdomain managements UI, and the “/wp-json/google-site-kit/v1/modules/adsense/data/sites?accountID=pub-xxxxxxxxxxxxx&_locale=user” API always returns state: null for all subdomains.

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer