-
Notifications
You must be signed in to change notification settings - Fork 315
Closed
Labels
Module: AdSenseGoogle AdSense module related issuesGoogle AdSense module related issuesP0High priorityHigh priorityType: BugSomething isn't workingSomething isn't working
Milestone
Description
Bug Description
As per one users comments in the WordPress support forums AdSense policy dictates that ads should not be displayed on 404 URLs.
Consider adding a conditional statement to ensure ads don't appear on such URLs.
More insights on AdSense policy available here, with the below guidance included:
Publishers are not permitted to place ads on any non-content based pages like thank you, error, log in, or exit pages.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The AdSense snippet should not be included on any WordPress 404 URLs (
is_404()
), neither for AMP nor for non-AMP. - This should be unconditional and always take effect, there should be no setting for it.
Implementation Brief
- Update the
Modules\AdSense\Tag_Guard::can_activate
method to returnFALSE
ifis_404()
returnsTRUE
.
Test Coverage
- Update the
Tests\Modules\AdSense\Tag_GuardTest
class to make sure thatTag_Guard::can_activate
method returns correct result for 404 pages.
Visual Regression Changes
- N/A
QA Brief
- Activate and connect AdSense module with use snippet setting enabled;
- Go to the homepage or any page on the frontend and make sure that ad code is added to the page;
- Go to a non-existing page (it should result in 404 status) and make sure that ad code is not added.
Changelog entry
- Ensure that the AdSense snippet is not included on 404 pages in the frontend.
Metadata
Metadata
Assignees
Labels
Module: AdSenseGoogle AdSense module related issuesGoogle AdSense module related issuesP0High priorityHigh priorityType: BugSomething isn't workingSomething isn't working