Jump to content

Does IPS not fully allow responsive Adsense in mobile?


gavpedz

Recommended Posts

This is something that has always bugged me and I thought I was the only one suffering this. I really appreciate you guys coming out and getting this addressed.

I have made the changes to custom.css using this as posted by @gavpedz:

 

/* GOOGLE AD CODE FOR RESPONSIVE ADS */
#ipsLayout_mainArea .adsbygoogle { width: 300px; height: 250px; }
@media (min-width:380px) { #ipsLayout_mainArea .adsbygoogle { width: 336px; height: 280px; } }
@media (min-width:764px) { #ipsLayout_mainArea .adsbygoogle { width: 728px; height: 90px; } }
@media (min-width:980px) { #ipsLayout_mainArea .adsbygoogle { width: 468px; height: 60px; } }
@media (min-width:1160px) { #ipsLayout_mainArea .adsbygoogle { width: 728px; height: 90px; } }

#ipsLayout_sidebar .adsbygoogle { width: 300px; height: 250px; }
@media (min-width:380px) { #ipsLayout_sidebar .adsbygoogle { width: 336px; height: 280px; } }
@media (min-width:980px) { #ipsLayout_sidebar .adsbygoogle { width: 300px; height: 600px; } }

but on mobile mode, the header banner still appears too small. The sidebar and footer ads show up as a nice big square ad, but the header ad stil shows up as a small leaderboard banner.

All 3 ads have been setup as responsive ads in Google.

Can anyone check it out using their iPhone or Android phone?

www.losdurosdelgenero.com

The very first ad shows up too small, but if you scroll down, the 2nd and 3rd ads show up as big squares.

 

This is how the ads are showing up:

header.thumb.JPG.e44cb3041e5c90c22da5c3977b4361c1.JPG

sidebar.thumb.JPG.ff21235e9d85ad122beb9b7f65b56e91.JPG

footer.thumb.JPG.c44a91213c5291dbd5ff1f14f72b291a.JPG

Link to comment
Share on other sites

  • Replies 54
  • Created
  • Last Reply

Yes I have been having that issue as well. I am guessing there is some other code or something that restricts that area but don't know. Oddly while testing in different viewport sizes in my browser to get the best fit ad sizes I did notice the header one show a taller ad once. So not sure if it will again or if it was just a one off. For me I am not to bothered for the moment as I am still testing IPS and have not done my final conversion yet. 

It is odd though seeing as none of the ad sizes in that code are small banners. Anyone able to shed any light on that? 

Link to comment
Share on other sites

10 minutes ago, gavpedz said:

Yes I have been having that issue as well. I am guessing there is some other code or something that restricts that area but don't know. Oddly while testing in different viewport sizes in my browser to get the best fit ad sizes I did notice the header one show a taller ad once. So not sure if it will again or if it was just a one off. For me I am not to bothered for the moment as I am still testing IPS and have not done my final conversion yet. 

It is odd though seeing as none of the ad sizes in that code are small banners. Anyone able to shed any light on that? 

Oh ok, at least now I know it's just not my setup. I have a feeling there might be some code somewhere that's affecting the #ipsLayout_mainArea ads, which is where the header ad code located.

Link to comment
Share on other sites

@LDDG I have the same issue as you, having took a look at your site you have ads on the login page, I'm guessing you are using the default header placement in settings. It's actually against Google policy to have them on login pages so be careful 

https://support.google.com/adsense/answer/1346295?hl=en-GB#Ads_on_non_content_pages

I manually placed a custom location key at the top and bottom of these templates for header and footer ads, that covers the main pages on the site

forums > front > forums > forumDisplay

forums > front > index > index

forums > front > topics > topic

Link to comment
Share on other sites

Is there a way to not show ads in certain forums? I have a couple of member only forums (they have to be logged in to see it) and obviously google doesn't allow you to show ads in hidden areas so was wondering how i can stop ads showing in certain forums.

Link to comment
Share on other sites

2 minutes ago, gavpedz said:

Is there a way to not show ads in certain forums? I have a couple of member only forums (they have to be logged in to see it) and obviously google doesn't allow you to show ads in hidden areas so was wondering how i can stop ads showing in certain forums.

I'm using custom location keys and have mine setup like this. Where you see array ( 9 ) in each section, replace with the forum id's you want to hide, should be the number inside each boards URL.

Topic Page 

forums > front > topics > topic

(use at the top of the template for the header, bottom for footer)

{{if \IPS\Request::i()->app == 'forums' and \IPS\Request::i()->module == 'forums' and \IPS\Request::i()->controller == 'topic'}}
	{{$forumId = 0; try { $topic = \IPS\forums\Topic::loadAndCheckPerms( \IPS\Request::i()->id ); $forumId = $topic->forum_id; } catch( \Exception $e ) {};}}
{{endif}}

{{if !in_array($forumId, array(9))}}
{advertisement="ADVERTKEY"}
{{endif}}

 

Around row 253 in the same template, this is after the first post. The middle 3 lines should already be there, just add the top if array line and closing end if. Quick tip if you want to change the number of posts before the advert shows, just change the number in $postCount == 1

I have 10 posts per page so set this to 5, that way with the header, this ad and footer you have the full page pretty much covered and doesn't look spammy when a topic only has like 2 posts in.

{{if !in_array($forumId, array(9))}}			
          {{if $postCount == 1 AND $advertisement = \IPS\core\Advertisement::loadByLocation( 'ad_topic_view' )}}
						{$advertisement|raw}
					{{endif}}
          {{endif}}

 

Forum Display

forums > forums > forumDisplay

(use at the top of the template for the header, bottom for footer)

{{if ( \IPS\Request::i()->controller == 'forums' AND isset( \IPS\Request::i()->id ) AND ! in_array( \IPS\Request::i()->id, array( 9 ) ) ) }}
{advertisement="ADVERTKEY"}
{{endif}}

forums > forums > topicRow

on row 10

(this is for the ad after the first topic in forum listing). Same as the topic page, you're just adding the first line and closing end if. Also if you want to change the number of topics before the advert shows change this number $rowCount == 1 again just like above, I have 20 topics per page so set this to 10

{{if ( \IPS\Request::i()->controller == 'forums' AND isset( \IPS\Request::i()->id ) AND ! in_array( \IPS\Request::i()->id, array( 9 ) ) ) }}
		{{if $rowCount == 1 AND $advertisement = \IPS\core\Advertisement::loadByLocation( 'ad_forum_listing' )}}
			<li class="ipsDataItem">
				{$advertisement|raw}
			</li>
		{{endif}}
        {{endif}}

 

Link to comment
Share on other sites

1 minute ago, daveoh said:

I'm using custom location keys and have mine setup like this. Where you see array ( 9 ) in each section, replace with the forum id's you want to hide, should be the number inside each boards URL.

Topic Page 

forums > front > topics > topic

(use at the top of the template for the header, bottom for footer)


{{if \IPS\Request::i()->app == 'forums' and \IPS\Request::i()->module == 'forums' and \IPS\Request::i()->controller == 'topic'}}
	{{$forumId = 0; try { $topic = \IPS\forums\Topic::loadAndCheckPerms( \IPS\Request::i()->id ); $forumId = $topic->forum_id; } catch( \Exception $e ) {};}}
{{endif}}

{{if !in_array($forumId, array(9))}}
{advertisement="ADVERTKEY"}
{{endif}}

 

Around row 253 in the same template, this is after the first post. The middle 3 lines should already be there, just add the top if array line and closing end if. Quick tip if you want to change the number of posts before the advert shows, just change the number in $postCount == 1

I have 10 posts per page so set this to 5, that way with the header, this ad and footer you have the full page pretty much covered and doesn't look spammy when a topic only has like 2 posts in.


{{if !in_array($forumId, array(9))}}			
          {{if $postCount == 1 AND $advertisement = \IPS\core\Advertisement::loadByLocation( 'ad_topic_view' )}}
						{$advertisement|raw}
					{{endif}}
          {{endif}}

 

Forum Display

forums > forums > forumDisplay

(use at the top of the template for the header, bottom for footer)


{{if ( \IPS\Request::i()->controller == 'forums' AND isset( \IPS\Request::i()->id ) AND ! in_array( \IPS\Request::i()->id, array( 9 ) ) ) }}
{advertisement="ADVERTKEY"}
{{endif}}

forums > forums > topicRow

on row 10

(this is for the ad after the first topic in forum listing). Same as the topic page, you're just adding the first line and closing end if. Also if you want to change the number of topics before the advert shows change this number $rowCount == 1 again just like above, I have 20 topics per page so set this to 10


{{if ( \IPS\Request::i()->controller == 'forums' AND isset( \IPS\Request::i()->id ) AND ! in_array( \IPS\Request::i()->id, array( 9 ) ) ) }}
		{{if $rowCount == 1 AND $advertisement = \IPS\core\Advertisement::loadByLocation( 'ad_forum_listing' )}}
			<li class="ipsDataItem">
				{$advertisement|raw}
			</li>
		{{endif}}
        {{endif}}

 

 

Thanks for that, really helpful. I wonder what happens when ips has an update do template edits get overwritten?

Link to comment
Share on other sites

2 minutes ago, gavpedz said:

Thanks for that, really helpful. I wonder what happens when ips has an update do template edits get overwritten?

When you update as far as I'm aware no templates are overwritten you have to manually update them. I use pretty much the stock theme with minor adjustments like this so I create a new theme after each update, open the old theme in a separate tab, uncheck unmodified then copy all my changes across. Forgot to say if you are using a custom theme the row numbers above might be different. 

Also forgot to add, if you have longer pages and say wanted to run an advert after the 5th and 10th post or 10th and 20th topic you can use 

$postCount == 3 OR $postCount == 7

$postCount == 5 OR $postCount == 10

and 

$rowCount == 10 OR $rowCount == 20

 

Link to comment
Share on other sites

Great thanks so much. What about error pages am i right in thinking google doesn't like ads to be displayed on error pages?

When i do my final conversion i will be looking to keep things pretty close to default as well Spent many years customising xenforo and in the end just leads to a lot of headaches and work so am going to try and keep things a bit simpler this time. 

Link to comment
Share on other sites

1 minute ago, gavpedz said:

Great thanks so much. What about error pages am i right in thinking google doesn't like ads to be displayed on error pages?

When i do my final conversion i will be looking to keep things pretty close to default as well Spent many years customising xenforo and in the end just leads to a lot of headaches and work so am going to try and keep things a bit simpler this time. 

That's right, these won't show on error pages, just the forum and topic pages. For the home page add a custom location key to the index template. Pretty much covers the main places you want adverts.

Link to comment
Share on other sites

Just now, daveoh said:

That's right, these won't show on error pages, just the forum and topic pages. For the home page add a custom location key to the index template. Pretty much covers the main places you want adverts.

 

Thanks will this also show in the gallery, downloads, pms etc or will that be in other templates?

Link to comment
Share on other sites

I don't have any revenue change I'm afraid as my forum is actually on xenforo and running ads as I want. I have been running a test conversion which is when I noticed this on IPS so now that I have figured this out I am almost ready to make the final conversion. 

Link to comment
Share on other sites

I've been experimenting, after removing the css from global.css and letting Google decide the size of ads I noticed a small increase, last night I've set the ad sizes to 768x90 banners on desktop/tablet and 320x280 square on mobile whilst leaving the header ad free to do as Google pleases. It's 4pm UK time and I've hit yesterdays total already.

No major increase in traffic, a usual steady day. 

It's too early to say if this down to the ad sizes but now I have the best paid units you would hope to see an increase, will need a full month to compare really.

Still struggling to understand why the css was added in the first place >_<

Link to comment
Share on other sites

17 minutes ago, David.. said:

Probably because IPB3 people were complaining as to why their non-responsive ads are breaking their community layout.

Can I sue them for loss of earnings? Bloody moaners, won't catch me moaning grrrrrr

Link to comment
Share on other sites

On 4/24/2017 at 3:21 PM, gavpedz said:

If anyone is interested this is what i have done with mine. (Bear in mind i have the sidebar on pretty much every page possible.)


/* GOOGLE AD CODE FOR RESPONSIVE ADS */
#ipsLayout_mainArea .adsbygoogle { width: 300px; height: 250px; }
@media (min-width:380px) { #ipsLayout_mainArea .adsbygoogle { width: 336px; height: 280px; } }
@media (min-width:764px) { #ipsLayout_mainArea .adsbygoogle { width: 728px; height: 90px; } }
@media (min-width:980px) { #ipsLayout_mainArea .adsbygoogle { width: 468px; height: 60px; } }
@media (min-width:1160px) { #ipsLayout_mainArea .adsbygoogle { width: 728px; height: 90px; } }

#ipsLayout_sidebar .adsbygoogle { width: 300px; height: 250px; }
@media (min-width:380px) { #ipsLayout_sidebar .adsbygoogle { width: 336px; height: 280px; } }
@media (min-width:980px) { #ipsLayout_sidebar .adsbygoogle { width: 300px; height: 600px; } }

 

Hello! I need some help :-) 

-why did you put at the 980 media width   a 468x60  and not a 728x90 ? 

- does what is in the curvy brackets mean

"show only sizes larger than  x by x  " /  "dont show sizes smaller than "    or

"show only sizes  that are x by x " 

what version should i use if i want a 970x250 to appear to specific screens? 

thank you! 

Link to comment
Share on other sites

well, this means that i could modify the ad code itself,

instead of adding code to the custom.css...

so, whats the difference... ?  that if you modify the adsense code,  the forum css will override  it ...  ? 

so, no matter what someone modifies inside the adsense code it will probably be useless unless he also /rather  changes the custom.css  to be in tune with what ze wants .  

(right? asking to make sure i got it right)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...