Forum Moderators: martinibuster

Message Too Old, No Replies

adsense & php include

against tos?

         

htdawg

11:48 am on Dec 3, 2008 (gmt 0)

10+ Year Member



question for asa. Is it against tos if you want to put adsense on your site buy using a php include?

for example create a page called ads.php & place adesense code there and use <?php include("ads.php"); ?> for all your pages so if you need to change or remove it you just have to edit or delete ads.php

koan

12:05 pm on Dec 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If it was, I'm sure more than half of the webmasters on this site would be in trouble.

leadegroot

12:08 pm on Dec 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, I'm not ASA, but - no! hell no!
The result is HTML (well, javascript - but lets not get picky here!) and all Google asks is that you paste in their javascript without alteration.
They don't say you have to paste it into something that resolves to the final URL, just that it is pasted in without alteration.

Its important to understand that PHP generates a final page of HTML (and css and javascript...) My pages are split amongst a collection of files which are included and functions and objects called to finally generate smooth HTML.
Adsense TOS doesn't comment in any way on any of this - they are concerned with the end result - the HTML that is served to the visitor.

netmeg

12:39 pm on Dec 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I do it on most if not all of my sites, and in fact, use PHP to randomly serve up different ad blocks, when I'm testing colors to see which are the best earners.

Just make sure the AdSense code is intact in your PHP include and no worries.

htdawg

1:10 pm on Dec 3, 2008 (gmt 0)

10+ Year Member



thanks for the replies.
I thought it might be against tos because the page ads.php would only have the adsense code on it. of course I would noindex it so it cant be spidered.

I couldn't find a definite yes or no answer at adsense TOS only that you cant place your code on pages with no content

denisl

1:47 pm on Dec 3, 2008 (gmt 0)

10+ Year Member Top Contributors Of The Month



htdawg - how do you no index a php file that simply contains the adsense code, and is it really necessary?

htdawg

1:59 pm on Dec 3, 2008 (gmt 0)

10+ Year Member



you add this <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
in your head tag of the page. or in robots.txt

I would do it so google wont index the page and have it show up in the search results

johnnie

2:01 pm on Dec 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



htdawg, since your PHP page is included server-side, google won't even know of its existence. Look at the generated output.

Bddmed

3:30 pm on Dec 3, 2008 (gmt 0)

10+ Year Member



you add this <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
in your head tag of the page.

This just doesn't make sense for a file to be included. Your metatags should be in the head of your HTML document. Adsense code belongs in the body. Would be an interesting experiment though, but I guess that will be a topic in the search forum.

leadegroot

8:24 pm on Dec 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you add this <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
in your head tag of the page. or in robots.txt

An included snippet to go in the body as an adsense block won't have a head section, and will never be visited (ideally) to use robots.txt

Rather than asking, actually try this - I think you will have an 'Aha!' moment :)

g1smd

8:41 pm on Dec 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Run the resultant "combined" page through the HTML validator and watch it complain about multiple head and body sections.