• Resolved dazman88

    (@dazman88)


    Hi,

    I would like to request a feature for the Adsense “Excluded from ads” option to have the ability to exclude ads by wp user roles. Currently, options are for All logged in users or users with posting ability, this limits the effectiveness of this feature.

    TIA

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    Thanks for reaching out @dazman88. As the plugin is open source, feel free to suggest this feature via opening a feature request over on the plugins GitHub repository. I’m happy to do so if you wish, on your behalf. Otherwise I can pass your suggestion on to the team.

    Note also that we do have a filter that allows you to perform that very action programmatically. The below, for example will disable the Site Kit AdSense snippet placement for users who are part of the officeAdmin role:

    add_filter('googlesitekit_adsense_tag_blocked','restrict_adsense_snippet_role' );
    function restrict_adsense_snippet_role() {
      // restrict ads for users that with a officeAdmin role
        if ( current_user_can('officeAdmin')) {
           return true;
        }
      return false;
    }

    That can be added to your site via a mini plugin, a custom snippets plugin, a child themes functions.php file or even your active themes functions.php file. If using the later, your active themes functions.php file, this will get overwritten with each time update.

    Let me know if you have any questions with the above.

    Hi @jamesosborne , I’ve tried adding the filter, but it didn’t seem to work when I tested with some other roles, eg: ‘reader’. Fyi, I’ve only installed Site Kit on my site and have not placed any Adsense ads snippet elsewhere, manually.

    Plugin Support James Osborne

    (@jamesosborne)

    Hi @bobbyforlife. If you’d like to open an individual support topic we can communicate with you from there. Please include any details relevant to what you’re experiencing. This may include a recording demonstrating the following:

    1. Where you’re adding the filter
    2. One of the users where this should apply to (ie. reader). Please show their user role.
    3. Logging in with that user and visiting the front end of the site.

    You can use a service such as Loom to share a screen recording.

    Note also that by default, AdSense will disable ads for logged in users. You may wish to check your this setting to ensure that ads should be appearing for all users first. This could be included in any recording you share. You can use this form to share a recording privately if preferred. Please reference your own support topic after creating one if using the form.?

    I’ll keep an eye out for your topic. Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Feature request: Adsense “Excluded from ads” by user role’ is closed to new replies.