Advertisement:
GCWebhosting

Author Topic: Adsense issues - Getting It Off Multiple Site Pages  (Read 22356 times)

Offline Dio

  • Semi-Newbie
  • *
  • Posts: 11
  • Gender: Male
  • Welsh Rarebit
    • Dirty Dio Bach's Web Fun
Adsense issues - Getting It Off Multiple Site Pages
« on: July 19, 2005, 06:48:41 PM »
Help For A PHP Luddite reuired, to stay inside the Adsense TOS.

I've got thus far. Its fair to say I know very little on PHP - well nothing in fact.

I've dredged through old threads where I found adding this would help to keep the adsense code off the Admin Pages and the Login Page:

Code: [Select]

if (!isset($context['admin_areas']) && $context['sub_template'] != 'login')
  echo '<div align="center" class="tborder">
<script type="text/javascript"><!--
google_ad_client = "pub-0691188711472327";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="8678466755";
google_color_border = "FFCCFF";
google_color_bg = "FFCCFF";
google_color_link = "333333";
google_color_url = "333333";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>';


Which works a treat. I want to expand that somewhat so it doesn't appear on post pages and any member profile pages. I'm guessing its something to do with this bit of the code.

Code: [Select]

$context['sub_template'] != 'login')


And was wondering what the syntax would be to make that for multiple site bits like post - profile etc. Any help appreciated, this is my first ever forum, and its been a breeze so far!
Crazy Frog Fans Forum [nofollow] | Cheesy Movies [nofollow] | Chav Mum [nofollow] | Viral Auctions [nofollow]

That's Welsh Dai-O, Not Ronnie James Day-o

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #1 on: July 21, 2005, 06:31:46 AM »
!in_array($context['sub_template'], array('x', 'y', 'z'))

-[Unknown]

Offline Dio

  • Semi-Newbie
  • *
  • Posts: 11
  • Gender: Male
  • Welsh Rarebit
    • Dirty Dio Bach's Web Fun
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #2 on: July 21, 2005, 07:23:59 AM »
Can I just confirm, instead of :

Code: [Select]
if (!isset($context['admin_areas']) && $context['sub_template'] != 'login')
I use

Code: [Select]
if (!isset($context['admin_areas']) &&  !in_array($context['sub_template'], array('x', 'y', 'z')))

in which case, x y z - is there a list of sub template names I can use there?

I already have 'login' - would it be like 'profile', 'post' ?

Thanks for the help so far
Crazy Frog Fans Forum [nofollow] | Cheesy Movies [nofollow] | Chav Mum [nofollow] | Viral Auctions [nofollow]

That's Welsh Dai-O, Not Ronnie James Day-o

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #3 on: July 26, 2005, 09:11:52 AM »
Yes.  There's no list on hand, but if you tell me what areas you want removed, I can tell you what you can use to remove them.

-[Unknown]

Offline Dio

  • Semi-Newbie
  • *
  • Posts: 11
  • Gender: Male
  • Welsh Rarebit
    • Dirty Dio Bach's Web Fun
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #4 on: July 26, 2005, 05:36:34 PM »
Awsome - basically, any user profile pages, personal message pages and the post a reply/topic page. I got admin and login covered. ;)
Crazy Frog Fans Forum [nofollow] | Cheesy Movies [nofollow] | Chav Mum [nofollow] | Viral Auctions [nofollow]

That's Welsh Dai-O, Not Ronnie James Day-o

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #5 on: July 28, 2005, 03:29:52 AM »
!in_array('profile', $context['template_layers']) && !isset($context['post_errors'])

Would be the simplest ways to check for those.

-[Unknown]

Offline Dio

  • Semi-Newbie
  • *
  • Posts: 11
  • Gender: Male
  • Welsh Rarebit
    • Dirty Dio Bach's Web Fun
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #6 on: July 28, 2005, 04:26:42 AM »
Yeah - that's got it suckered. I can stay with in the Adsesne TOS now. Sending a virtual pint or three your way now. :D
Crazy Frog Fans Forum [nofollow] | Cheesy Movies [nofollow] | Chav Mum [nofollow] | Viral Auctions [nofollow]

That's Welsh Dai-O, Not Ronnie James Day-o

Offline icfsindia

  • Semi-Newbie
  • *
  • Posts: 10
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #7 on: August 07, 2005, 05:07:21 AM »
Thanks for all the postings of  yours.

What I understand,

Quote
if (!isset($context['admin_areas']) && $context['sub_template'] != 'login')

This will disable google adsense code from functioning in admin pages and login page.
The code is pasted after this statement with a echo' command.


Quote
!in_array('profile', $context['template_layers']) &&
!isset($context['post_errors'])

This will  enable you to collect the various sub_template names like login for
login template etc.

But how and where to use this and how to obtain the list of templates.  I did
not understand..


Quote
if (!isset($context['admin_areas']) &&  !in_array($context['sub_template'],
array('x', 'y', 'z')))

This is the code that is to be used to disable the code from more than one
pages, where x, y and z are to be replaced with the relevant names of the
templates related to the pages in which the ads are to be disabled.

Please help me out

Regards
Ratnakar

Offline Gargoyle

  • Sophist Member
  • *****
  • Posts: 1,148
  • Gender: Male
    • South Side Street Cars
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #8 on: August 07, 2005, 11:02:18 AM »
Could you please post the entire code for this check that you and [unknown] have done such a good job at figuring for the rest of us to use Dio ?

I have been struggling with this as well and your code would make my life a ton easier.

Offline icfsindia

  • Semi-Newbie
  • *
  • Posts: 10
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #9 on: August 07, 2005, 12:00:16 PM »


   // Show the menu here, according to the menu sub template.
   template_menu();

   echo '
         </td>
      </tr>';

// Show ads only in non-mod/admin areas

if (!isset($context['admin_areas']) && $context['sub_template'] != 'login' )
~~~~~Actual content switched off/on by the if() condition~~~~~

   echo '
<tr><td align="center" colspan="2" height="100" valign="bottom" bgcolor="#d0d0d0">

<script type="text/javascript">
google_ad_client = "pub-XXXXXXXXXXX";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_channel ="XXXXXXX";
google_color_border = "d0d0d0";
google_color_bg = "FFFFFF";
google_color_link = "000080";
google_color_url = "005177";
google_color_text = "000000";
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js [nofollow]"> </script>

</td></tr>';
~~~~~End Actual content switched off/on by the if() condition~~~~~

   // Show a random news item? (or you could pick one from news_lines...)
   if (!empty($settings['enable_news']))

Offline Dio

  • Semi-Newbie
  • *
  • Posts: 11
  • Gender: Male
  • Welsh Rarebit
    • Dirty Dio Bach's Web Fun
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #10 on: August 07, 2005, 12:39:18 PM »
That's about it - but you can use a div align and a set class as well if you like, to add the content in the style of the block the ad appears in.

However, something is going wrong somewhere for me - I'm now getting the code showing in admin areas and login pages, but not in PM and those areas. I wish I knew PHP :(
Crazy Frog Fans Forum [nofollow] | Cheesy Movies [nofollow] | Chav Mum [nofollow] | Viral Auctions [nofollow]

That's Welsh Dai-O, Not Ronnie James Day-o

Offline Gargoyle

  • Sophist Member
  • *****
  • Posts: 1,148
  • Gender: Male
    • South Side Street Cars
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #11 on: August 07, 2005, 12:46:52 PM »
Very good! I am off to a great start now!

I am still confused by this one though....
!in_array('profile', $context['template_layers']) && !isset($context['post_errors'])

I tried to implement it but I get errors when I do. I must be missing something.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #12 on: August 07, 2005, 01:37:51 PM »
Very good! I am off to a great start now!

I am still confused by this one though....
!in_array('profile', $context['template_layers']) && !isset($context['post_errors'])

I tried to implement it but I get errors when I do. I must be missing something.

Instead of:

if (!isset($context['admin_areas']) && $context['sub_template'] != 'login')

Use:

if (!isset($context['admin_areas']) && $context['sub_template'] != 'login' && !in_array('profile', $context['template_layers']) && !isset($context['post_errors']))

-[Unknown]

Offline Gargoyle

  • Sophist Member
  • *****
  • Posts: 1,148
  • Gender: Male
    • South Side Street Cars
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #13 on: August 07, 2005, 02:05:29 PM »
Very good... Thank-you. ;D

Offline Dio

  • Semi-Newbie
  • *
  • Posts: 11
  • Gender: Male
  • Welsh Rarebit
    • Dirty Dio Bach's Web Fun
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #14 on: August 07, 2005, 03:15:44 PM »
I figured out why it had stopped working for me, and all is fine now (using old verison of the page).  :-X

Except for one last place that I'd like to remove it from. The register pages. Any ideas how? Is there one final switch to add to the above code or is it just causing more nightmares. :)

Then finally I can relax about having adsense on the forum. :)
Crazy Frog Fans Forum [nofollow] | Cheesy Movies [nofollow] | Chav Mum [nofollow] | Viral Auctions [nofollow]

That's Welsh Dai-O, Not Ronnie James Day-o

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #15 on: August 07, 2005, 06:27:20 PM »
For the registration page:

isset($context['require_agreement'])

There are other methods, but that's probably going to stand up best to upgrades.

-[Unknown]

Offline Dio

  • Semi-Newbie
  • *
  • Posts: 11
  • Gender: Male
  • Welsh Rarebit
    • Dirty Dio Bach's Web Fun
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #16 on: August 07, 2005, 06:49:05 PM »
Thanks once again. I am finally sorted this time... I promise. As far as I can see I'm now totally within the AdSense TOS. :)

I'm sure this info will be of use to quite a few people like myself - thanks for taking the time to help out a newb. :)
Crazy Frog Fans Forum [nofollow] | Cheesy Movies [nofollow] | Chav Mum [nofollow] | Viral Auctions [nofollow]

That's Welsh Dai-O, Not Ronnie James Day-o

Offline icfsindia

  • Semi-Newbie
  • *
  • Posts: 10
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #17 on: August 08, 2005, 12:55:41 AM »
Quote
isset($context['require_agreement'])

The above code removed the ads from the search page.

A summary of what I understood.

Quote
if
(!isset($context['admin_areas'])
          --> Specifies all pages accessible only to the admin
$context['sub_template'] != 'login'
          --> Specifies login page
!in_array('profile', $context['template_layers'])
          --> Specifies profile page
!isset($context['post_errors'])
          --> Specifies postage error page
isset($context['require_agreement']))
          --> Specifies search page

What is the code for removing the ads from agreement page.  I think that is the only area that is left to be handled.

I did not read through the google TOS clearly.  Is it a requirement that we eliminate the code from the search page.


Offline icfsindia

  • Semi-Newbie
  • *
  • Posts: 10
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #18 on: August 08, 2005, 01:00:34 AM »
Quote
if (!isset($context['admin_areas']) && $context['sub_template'] != 'login' && !in_array('profile', $context['template_layers']) && !isset($context['post_errors']) && isset($context['require_agreement']))

Hi all the code seems to have removed the ads from the calendar page also.

I want the ads to appear on the calendar page.  Is it in any way a violation of googles TOS to make ads appear on the calendar page!!!

Is my analysis that
Quote
!in_array('profile', $context['template_layers'])

removes ads from calender, etc correct!!!

Offline icfsindia

  • Semi-Newbie
  • *
  • Posts: 10
Re: Adsense issues - Getting It Off Multiple Site Pages
« Reply #19 on: August 08, 2005, 01:13:55 AM »
Google AdSense Program Policies
Ad Placement
  • Up to three ad units may be displayed on each Web site page.
  • A maximum of two Google AdSense for search boxes may be placed on a page.
  • A single link unit may be placed on each Web site page, in addition to the ad units and search boxes specified above. Link units are considered to be 'Google ads' for purposes of these program policies.
  • No Google ad may be placed on any non-content-based pages. This includes error, login, registration, "thank you" or welcome pages.
  • No Google ad or Google search box may be displayed on any domain parking websites, pop-ups, pop-unders, or in any email.
  • No Google ad may be placed on pages published specifically for the purpose of showing ads, whether or not the page content is relevant.
  • Elements on a page must not obscure any portion of the ads, and the ad colors must be such that any ad elements, including text and URL, are visible.
  • Clicks on Google ads must not result in a new browser window being launched.
Google AdSenseTM Online Standard Terms and Conditions



(v) display any Ad(s) or Link(s) on any error page, on any registration or "thank you" page (e.g., a page that thanks a user after he/she has registered with the applicable Web site), on any chat page, in any email, or on any Web page or any Web site that contains any pornographic, hate-related, violent, or illegal content;

Conclusions

Do not display ads on login, error, registration, thankyou pages.
Where was the restriction relating to displaying ads on admin pages.
however since clicking on ads by the web site publisher himself would amount to fraud, may be it would be convenient to eliminate ads appearing on admin pages.
« Last Edit: August 08, 2005, 01:23:18 AM by icfsindia »