site-kit-wp: Inform user about existing Ad Blocking Recovery tags placed on their website
Feature Description
As part of the setup, Site Kit will have to send user to the AdSense console to create their Ad Blocking Recovery message. However, the steps to place the Ad Blocking Recovery and error protection tag is quite prominently featured in the same area, and user may accidentally place the tags manually not realizing that Site Kit will do this for them.
We should detect that manual placement as part of existing tag and inform user about it to avoid potential duplicate tags. This notice should be shown in AdSense settings and possibly as part of the setup.
Update: upon further discussion with @marrrmarrr and her checking in internally, we’ve decided to not surface anything related to Ad Blocking Recovery tags if the site has an existing Ad Blocking Recovery tag. Details of decision can be found in this slack thread.
However, if the site sets up Ad Blocking Recovery using Site Kit, and then places the tags manually as well, they should be about the non-SK placed tags.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- When
adBlockerDetection
feature flag is enabled, the data store of AdSense module should have dedicated selectors to check whether the site has Ad Blocking Recovery tag that is not placed by Site Kit.- This should be separate from the selector that checks for the regular AdSense tag.
- If a have existing Ad Blocking Recovery Tag:
- For a site that doesn’t have Ad Blocking Recovery set up via Site Kit, do not surface any Ad Blocking Recovery related UI elements in the Site Kit Dashboard and Settings.
- For a site that has Ad Blocking Recovery set up via Site Kit, inform the user about it in the Setting, with language similar to the ones used in
SettingsForm
.
Implementation Brief
- Create a new partial store under
assets/js/modules/adsense/datastore
. - The structure of this store will be inspired by
createExistingTagStore
, but with modifications to cater specifically to ad-blocking recovery. - The
waitForExistingTag
action and control should be eliminated by leveraging the resolve select.
Constants
- Define appropriate constants for action types such as:
FETCH_GET_EXISTING_AD_BLOCKING_RECOVERY_TAG
,RECEIVE_GET_EXISTING_AD_BLOCKING_RECOVERY_TAG
,
Actions
- Create the following actions for fetching and receiving the ad-blocking recovery tag and ad-blocking error protection tag:
fetchGetExistingAdBlockingRecoveryTag
,receiveExistingGetAdBlockingRecoveryTag
,
Controls
- Define the logic for the actions
FETCH_GET_EXISTING_AD_BLOCKING_RECOVERY_TAG
. - The control callback should only fetch the respective Ad Blocking tag from non-AMP pages. In other words, we should not fetch the Ad Blocking tags from AMP pages.
Reducer
- Simplify the reducer using the
createReducer
helper function from the Immer library.
Resolvers
- In the resolvers, the logic for
getExistingAdBlockingRecoveryTag
should be defined. - The regex for the matching the existing Ad Blocking Recovery tag should be defined in the
getExistingAdBlockingRecoveryTag
resolver.
Selectors
- Define the following selectors for both the ad-blocking:
getExistingAdBlockingRecoveryTag
,hasExistingAdBlockingRecoveryTag
,
In assets/js/modules/adsense/components/settings/SettingsForm.js
:
Hide CTA
- In Ad Blocking Recovery Main Notification and Settings CTA
- Check whether the site has existing tag using
hasExistingAdBlockingRecoveryTag
. - Don’t render the component if site has existing tag.
- Check whether the site has existing tag using
Setting Notice
- Using the
getExistingAdBlockingRecoveryTag
selector, check if the site has an existing Ad Blocking Recovery tag. - If the site has an existing Ad Blocking Recovery tag and it is same as the account ID set up via Site Kit, show the following message:
'You’ve already got an Ad Blocking Recovery code on your site. We recommend you use Site Kit to manage this to get the most out of AdSense.',
- If the site has an existing Ad Blocking Recovery tag and it is different from the account ID set up via Site Kit, show the following message:
'Site Kit detected Ad Blocking Recovery code for a different account %s on your site. For a better ad blocking recovery experience, you should remove Ad Blocking Recovery code that’s not linked to this AdSense account.'
Test Coverage
- Add unit tests for the new data store.
QA Brief
- Go to AdSense console > Privacy & messaging > Ad blocking recovery, and click on the
Tagging
tab. - Copy the Ad Blocking Recovery script and paste it into the site’s
<header>
. - Go to the AdSense settings page in Site Kit and verify if the settings notice is shown for the same account ID version.
- Change the account ID in the Ad Blocking Recovery script.
- Verify if the settings notice is shown for the different account ID version.
- Check the IB for the notices.
- Verify the
AdBlockingRecoveryCTA
is not shown in the AdSense settings page if the site has an existing Ad Blocking Recovery tag. - Verify the
AdBlockingRecoveryWidget
is not shown in the Site Kit Dashboard if the site has an existing Ad Blocking Recovery tag. - Verify that the notice is not shown in the AdSense settings page if the site does not have an existing Ad Blocking Recovery tag.
- Verify that the ABR tag unchecked notice is not shown when there’s an existing ABR tag and the related notice is being displayed.
- Verify that both AdSense and Ad Blocking Recovery existing tag detection works together and independently.
Changelog entry
- Show notice to users who have an existing Ad Blocking Recovery tag placed on their site.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16
Commits related to this issue
- Merge branch 'develop' into enhance/#6967-existing-ad-blocking-recovery-tags. — committed to google/site-kit-wp by hussain-t a year ago
- Merge pull request #7208 from google/enhance/#6967-existing-ad-blocking-recovery-tags Enhance/#6967 - Inform user about existing Ad Blocking Recovery tags — committed to google/site-kit-wp by tofumatt a year ago
Upon discussion with @aaemnnosttv and @hussain-t, I have updated the AC/IB and removed all parts about the error protection code.
It’s very unlikely that someone will have existing error protection tag placed in their website without also placing the main Ad Blocking Recovery tag. So it overcomplicated things with for very little benefit.
We can just inform the user about the ABR tag and not do anything about error protection tag for now and revisit this in the future if needs be (very unlikely).
I’ve also added a point in the IB to satisfy the first part of the second bullet point of the AC and updated the estimate accordingly.
Cheers.
This is awesome and much simpler—I think this is the right call too actually, it’s much simpler and handles the majority case 👍🏻
IB ✅