Existing official AdSense snippet not detected
Bug Description
Site Kit's existing tag detection for AdSense does not detect the snippet provided by AdSense for users to put on their site.
<script data-ad-client="ca-pub-1234567890" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
Steps to reproduce
- Manually place the html snippet provided by AdSense on the homepage
- Set up AdSense module
- Existing tag is not found, setup completes as usual
Expected (or similar)
The above is using a dummy publisher ID
Saw

Screenshots

Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The following type of AdSense snippet should be detected when it exists on the frontend:
<script data-ad-client="ca-pub-1234567890" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
Implementation Brief
- Update AdSense regex to check for
scripttags as well/<(?:script|amp-auto-ads) [^>]*data-ad-client="([^"]+)"/gm
Changelog entry
- Improve detection of existing AdSense snippets to cover more variants of snippets.
IB ✅
Tested
I adjusted the code for Adsense to trigger the above copy using a dummy ID.

Adjusted the code for Adsense to find my domain as a positive test.
Adsense code:

Adsense Google user: Username: [email protected] Password: gpev8D1DiVq9X8g
Adsense account:

Code on my host:

Setup prompt

One thing to note the Continue link pops a new tab and refreshes the Adsense connection setup
Need some insight as to what I should adjust to be able to have Adsense see the code. This isn't a pass for me.
Confirmed with @aaemnnosttv that this is expected behavior via SK slack channel. Passed QA ✅