Jump to content

Adsense auto ads - how to show only for selected member groups


Recommended Posts

Or how to exclude member group (s).

I saw the thread that discussed this with Adsense Auto Ads from about three years ago.  I think both adsense and invision  have since changed.  The instruction did not work for me.

I have a member group that pays to have no ads and cannot figure out how to exclude a member group.

If anyone is currently using Auto Ads on Adsense and has success controlling which member groups are subject to auto ads and which one see just the ads I place, please share.  My revenue was higher with auto ads, so I would like to find a way to use without fouling up member groups.

Thank you.

Link to comment
Share on other sites

This is not something you can check on/off in the core platform, but it's a relatively simple template edit.  In the global template, you can do something like:

{{if \IPS\Member::loggedIn()->member_group_id === 4}} 

	SOME CODE HERE THAT WOULD ONLY SHOW TO ADMINS

{{endif}}

If you wanted to show some code to a bunch of different member groups...  

{{if in_array( \IPS\Member::loggedIn()->member_group_id, array( 5, 10, 11 ) )}}

	SOME CODE HERE THAT WOULD ONLY SHOW TO SPECIFIED GROUPS

{{endif}}

 

Edited by Randy Calvert
Link to comment
Share on other sites

On 9/22/2022 at 10:43 PM, Randy Calvert said:

This is not something you can check on/off in the core platform, but it's a relatively simple template edit.  In the global template, you can do something like:

{{if \IPS\Member::loggedIn()->member_group_id === 4}} 

	SOME CODE HERE THAT WOULD ONLY SHOW TO ADMINS

{{endif}}

If you wanted to show some code to a bunch of different member groups...  

{{if in_array( \IPS\Member::loggedIn()->member_group_id, array( 5, 10, 11 ) )}}

	SOME CODE HERE THAT WOULD ONLY SHOW TO SPECIFIED GROUPS

{{endif}}

 

Unfortunately it didn't work for auto ads .

Link to comment
Share on other sites

If you are only doing it for guests...  it's even easier.  You don't need to check group.  Just check if logged in.  

        {{if \IPS\Member::loggedIn()->member_id === NULL}}
        	<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXXXX" crossorigin="anonymous"></script>
        {{endif}}

Smack that right before your end head code.  

Regarding appearing in other themes, make sure you don't have any ad code stuck somewhere in the IPB ad area that Jim linked to above.  You cannot use the auto ads there...  it MUST be in the global template otherwise it will not get added to the header and instead just stuck in wherever is setup within the body.  

Link to comment
Share on other sites

Try turning those off...  because they may be causing problems.  Also don't just look for the ad to be displaying.  Actually right click and view source.  Look at the code to make sure it's injecting to the right group.  

Google does not always decide to return ads for every site on every request.  The only way to confirm it's actually "working" is to check for the code.  If the code is there, then it's a Google problem of them deciding not to show the ad.  

Link to comment
Share on other sites

3 hours ago, Marc Stridgen said:

You could also add some random text at the top to ensure its inserting things as required

 

it works as it should and appears correctly on page source.

17 hours ago, Randy Calvert said:

Try turning those off...  because they may be causing problems

and finally that`s the problem.

The first part of fixed ads is exactly the same code as auto ads .

Link to comment
Share on other sites

5 minutes ago, BradTBP said:

I have seen the same thing and it wrecks my paid subscribers!

If you're using the Adsense auto ad code within the IPS advertising system, it will NOT work.  Disable all ads in the advertising manager and use the template logic system.  The code that I used above does work.  The person you were quoting was using the auto ad code within the IPS advertising system, which puts the ad code in the wrong spot (within the body instead of the head).  This will cause very unstable results.  

Link to comment
Share on other sites

I did not put the auto ads in the IPS advertising system, I put it in my template between head tags.  However, I still put in individual ad code in the IPS advertising system to ensure ads in certain places.  I will try it on a clean template with no IPS system ads at all.  

I appreciate all the dialogue on this thread.  Thanks.  Hopefully, I can come back and tell you I'm in good shape!

Link to comment
Share on other sites

In other words if you want to work the above code with auto ads do not place fixed ads anywhere in your community.

The only way I found that seems to work properly is to exclude a page from auto ads and on this page in your community to add custom blocks with fixed ads.

This way the above code works correclty.

 

With ips internal advertisements when you check a specific location to show the advertisement(e.g. Just above the page footer) is there a way to exclude specific pages? ?

Link to comment
Share on other sites

On 2/6/2019 at 7:29 AM, newbie LAC said:

Hello,

Show ad

{{if (\mb_strpos($_SERVER['REQUEST_URI'], 'test') !== false)}}
1
{{endif}}

Hide ad

{{if !(\mb_strpos($_SERVER['REQUEST_URI'], 'test') !== false)}}
1
{{endif}}

 

 

The above seems to work fine if it placed in extra condition tab but i`m not pretty sure that is exactly right 

Link to comment
Share on other sites

  • 9 months later...
  • 1 month later...
On 7/17/2023 at 2:49 AM, Marc Stridgen said:

Im not sure one relates to the other. You can have auto ads and still exclude usergroups

In the past when I tried auto ads, it displayed for everyone even thought I had members excluded. 

I want to exclude members for a couple of reasons. One, as a benefit of membership, they see no ads. Two, members tend to want to 'help' the board earn money by click, click, clicking as many ads as possible, and that will cause Google to eliminate our ability to have ads. 

Link to comment
Share on other sites

  • 2 weeks later...
On 9/4/2023 at 4:48 AM, Marc Stridgen said:

I would need an example of this not working on your site in order to advise. If you havent selected for them to see ads within our ad system, they shouldnt be seeing them at all.

I can't swear that it was after my upgrade a few months ago or before. I'll run a test and see what happens.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...