I've got the site up and running and i tried putting the adsense code into a block with full html access but nothing happens. Apparently the adsense module is not compatible so I was wondering how to get it up and then what would I toggle to share the profits with members?

Consider me a newbie to drupal

Comments

palvishal’s picture

The Same Issue I am also facing with Drupal 6. Is it we hold on untill the adsense module update releases for drupal 6 or we move to an older version of drupal.
Is there any othere way to put adsense in drupal 6 ?

Please suggest

droshani’s picture

I think with all functionality and feasibility around Drupal 6, it fails to address costume module building. It would be nice to be able to create costume module to run small script like Google Adsense.

lenkkivihko’s picture

I do not know the purpose of adsense module, as you can cut and paste the Adsense code to your custom block.

For more examples, please see: http://drupal.org/node/21867

Harjoituspäiväkirja - www.lenkkivihko.fi

droshani’s picture

I created costume block and pasted my Adsense code, but it does not work, Any idea why?

Quint’s picture

did you set it to HTML?

doubleedgedpen’s picture

1. Go to Administer > Input Formats
2. Add a new input format (I called mine Google Adsense)
3. Enable the input format for any Roles that will need to use it
4. DO NOT select any filters
5. Click Save Configuration

6. Go to Administer > Blocks
7. Add a new block
8. Paste the code from Google Adsense directly into the Block Body text area.
9. Choose the input format that you created above
10. Save Block
11. Configure the block to display where you want it

The "Full HTML" input format does not work for Google Adsense code.
It is not necessary to enable the PHP Filter for Google Adsense Code.
This method is working on my Drupal 6.3 site without the Adsense Module.

Nathan

purplekitty’s picture

Thank you, Nathan! I've been trying to figure this out for hours today. The new input format instructions worked like a charm. In fact, it also has enabled my pop unders code too!

Debi

andygimpaya’s picture

This works for me. Thank you Nathan.

oscardb2’s picture

Thanks Man, as a newbie I spent two days trying to figure this out!!! Worked like a charm

amir simantov’s picture

Good! Thanks!

michaeldutton’s picture

doubleedgedpen's instruction worked great on my website www.rateAprofessional.com

netnik’s picture

Brilliant! Thank you so much!

sks15284’s picture

Thanks for this, its really working..............

LM23’s picture

Not working here, with pasting adsense code to a new block :(
Ideas?

Thank you very much!

LM23’s picture

Confirm if this is not working?
Is there a working way to have adsense as block/module in drupal 6?

Does anyone has a drupal 6 website with adsense?

thanx

MidGe48’s picture

droshani’s picture

www.koyauniversity.org
www.kurdistanica.com
www.kurdishacademy.org

"We must become the change we want to see" [quote: Mahatma Gandhi]

droshani’s picture

I did create the block, you have to select Full HTML input format. I do not get any adds thou. I think it cause by me testing sever, I am working without domain where direct IP address appear in the as URL. I am not sure if Google Adsense stop working because of this.

The Class for the Block look strange as it make the 160x600 Google Adsense block to appear as 400x600 which is wider than actual column and mess up the Garland Theme. If some one try to do this customize block with a domain name it would be nice.

The_cobra666’s picture

I to have this problem. It's not working. And yes full html has been set, it doesn't WORK!

It's a problem with drupal 6. No one got a work around?

LM23’s picture

With FULL HTML and nic edit i cant even edit teh block anymore - it loops and loads teh page :(
When i try to edit teh template directly, it want work either ...
omg has no 1 a clue?

Please

The_cobra666’s picture

If I put the code in the block, drupal even "flips". It doesn't display the options of the block correctly. I've got to refresh the page to make it work correctly... and then it doens't even work like I should work... If I place for example in the page option box "image/*" that it my only display the block on those pages... it saves this to in the body for the block...

There's something wrong with it, without a doubt!

palvishal’s picture

After trying out multiple options like making Blocks, by selecting HTML, Filter HTML etc. Finally I make adsense to display some how in my website. I make my new Content by selecting a PHP Code. I have uploaded a PHP Code and Adsense Module to make this work.
If there is some better way to do this please let me know here.

The_cobra666’s picture

Hi,

What PHP and Adsense module? Does it exist for Drupal 6?

LM23’s picture

Are you sure you run the version 6?

palvishal’s picture

To make adsense work on Drupal 6 I have enabled a module PHP Filter.

Administrator >> Site building >> Module >> PHP Filter

Then after any new content I make, I use the Input format PHP Code Instead of Filtered HTML or Full HTML. You can set it to always open New content by default as PHP Code Input format. To do this go to

Administrator >> Site configuration >> Input formats

Tick on PHP Code and click on SET DEFAULT FORMATS

Second steps is to paste your adsense code. To do this edit the Content page/story as HTML ( I am using a nicedit WYSIWYG Editor, which gives option to edit page as HTML) paste your content between your pages where you want.
I have created a test page to show you all that it works. Here is the link
http://pingoit.com/PingoIT_Testpage_for_adsense

For time being I am Ok with this but I am still searching more advanced method to do this. I will update all about my finding also if anyone else have find any solution for this please let me know.

droshani’s picture

why did not you create a block and past the code with PHP Filtering?
It make it is easer to display the block on every page rather than on contact page.

Well to add to this note I just did that myself and it is working
http://98.131.16.97/

What you do
1. activate your PHP filter module
2. Create a block and past your Google Adsense as HTML source
3. Select PHP filter out formate
4. Activate you newly created block

and it works
look at here http://98.131.16.97/ and don't be shy juts click on the adds :)

palvishal’s picture

I have 2 Column website so don't want Adsense in a block fashion. For me adsense coming between paragraph gives me more output :) as campare to block on lefthand or right sidehand of cloumn.

http://www.pingoit.com

Cheers!

LM23’s picture

Thank you koyauni and palvishal so much !!!!!!!

Web-Design & Music
http://galaxymachine.de

southfloridafusion’s picture

Mine still isnt working any ideas?

I did your steps 1-4 and pasted my adsense itno the block as an html source. But, one of two things happens

1. it just shows pasted code
2. it just shows blank box

Here is my link, notice both ads just show code only http://www.steakandeggsdiet.com/

datu rocc’s picture

this worked a great deal.

ravis’s picture

Thanks a lot........
It worked for me. Actually the previous version of Drupal. 5.X was having php format already in Input Format Type. So, I was little confused about this..Didn't care to see the module.

Thanks :)
my tech Site

I work at Drupar.com

videodoll’s picture

You just helped me out a lot!

huang_cn’s picture

simply chose PHP code in input format then you are good to go.

http://voiceofchinese.com/huang

charlieman’s picture

Hi, just to add a comment, I made it work creating a new input format without selecting any of the filters.

mustardman’s picture

One problem with creating Adsense blocks or inserting the ad directly into the site is that you do not get section targeting. So adsense may post ads about coding and PHP or whatever it sees in Drupal whereas the content people see may have nothing to do with that.

If you have a purely php theme you can add this into the theme php file

<!-- google_ad_section_start --> 
"print page function or body content"
<!-- google_ad_section_end -->

There may be a way to add this into stylesheets if the theme uses that but I don't know how. The adsense module has section targeting built in and I believe optimizes it even better so that would be one advantage to using the module as opposed to creating blocks. I don't have that option as I use Drupal 6.

DocMartin’s picture

Or (as I put in later post): I've put ad_section code in blocks, used php filter; one of them above content, the other below. Looking at source code for pages, seems ok.
____________________________
DocMartin and Hong Kong Outdoors CheungChauHK 長洲HK

____________________________
DocMartin and Hong Kong Outdoors

smallzi’s picture

it works.

smallzi’s picture

I created a new block called "ad" that is displayed in the right sidebar, and enabled the php filter module. Below is just the code snippet generated by google, with quotes replaced by apostrohpes, stored as a string, and outputted via echo. It works on http://www.potentialhuman.org with drupal 6.1.

>
$foo="<script type='text/javascript'><!--
google_ad_client = 'pub-5384434376842053';
/* 160x600, created 4/5/08 */
google_ad_slot = '3339531126';
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type='text/javascript'
src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>
</script>";
echo $foo;
marius.s’s picture

smallzi,

Your suggestion works, I just had to change:

<?php
>
$foo=

to

<?php
$foo=

ie removed ">" symbol from second line

Marius
www.cringel.com

smallzi’s picture

good catch, marius. here is the code without the mistake


$foo="<script type='text/javascript'><!--
google_ad_client = 'pub-5384434376842053';
/* 160x600, created 4/5/08 */
google_ad_slot = '3339531126';
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type='text/javascript'
src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>
</script>";
echo $foo;
smallzi’s picture

Looks like charlieman beat me to the punch, but here are detailed instructions:

login as user 1 (the administrator) and navigate to administer >> site configuration >> input formats. Add an input format, and name it whatever unique name you want. Drupal graciously allows for the assignment of roles for input formats. You can keep your users from displaying porn ads in your forums, and still retain the ability to post active content.

Now, the offending filter preventing adsense ads from displaying is the "HTML filter." Enabling or disabling any combination of filters will allow adsense ads to properly display AS LONG AS "HTML filter" is turned off. The HTML filter carries this description:

"Allows you to restrict whether users can post HTML and which tags to filter out. It will also remove harmful content such as JavaScript events, JavaScript URLs and CSS styles from those tags that are not removed."

Adsense ads are displayed via javascript. Go figure.

Translation: configure your format any way you want, just disable HTML filter, and assign roles carefully.

With this new input format enabled, you can post a google generated snippet anywhere and it should display properly.

PerryM’s picture

I'm up and running fine.

I left off the php <?Php and ?> and just used the AdSense code and it works just fine.

Hawkeyi’s picture

You have to set the input format to php code. Full HTML is only for html and doesn't allow javascript.

DocMartin’s picture

Thanks for the info
Just tried block w Google code pasted in, input format set to php (after enabled php module)

Found this worked; but block blank when placed after text - works above it. Might just be glitch w google; but I figure maybe something to do w html filter kicking in with content.
____________________________
CheungChauHK 長洲HK - South China Sea island in Hong Kong.
Hong Kong Outdoors

____________________________
DocMartin and Hong Kong Outdoors

droshani’s picture

I have done this for all my projects, just create a block and past the code with PHP Filtering.

It is easer to display the block on every page
please view here
http://kurdistanica.com/

I did this by
1. activate your PHP filter module
2. Create a block and paste your Google Adsense as HTML source (you have to make sure you are not in rich text mode)
3. Select PHP filter formate from the list. This has be e done
4. Activate you newly created block in block section and put it where you wish

and it works

look at here another example http://www.kurdishacademy.org/

DocMartin’s picture

Just trying using blocks for section targeting

Tried w html, but didn't look good in page source code; the php code trick seems to work here tho.

One block for google_ad_section_start code (which filter deletes here if put in full)

another for google_ad_section_end

in theme settings (Zen, lest yours lacks these places), placing these at top and bottom of content. Looks ok in page source.
____________________________
CheungChauHK 長洲HK - South China Sea island in Hong Kong.

____________________________
DocMartin and Hong Kong Outdoors

abelleba’s picture

Finally found a simple way of getting google adsense to work on Drupal 6 using a block. These instructions actually work and are well detailed using a default theme.
http://computerquestionhelp.com/blogs/Misc/getting-google-adsense-to-eas...

droshani’s picture

This is a module for D6x

http://drupal.org/project/simplead_block

"We must become the change we want to see" [quote: Mahatma Gandhi]

Team Covenant’s picture

The solution was posted by nathan, above:

1. Go to Administer > Input Formats
2. Add a new input format (I called mine Google Adsense)
3. Enable the input format for any Roles that will need to use it
4. DO NOT select any filters
5. Click Save Configuration

6. Go to Administer > Blocks
7. Add a new block
8. Paste the code from Google Adsense directly into the Block Body text area.
9. Choose the input format that you created above
10. Save Block
11. Configure the block to display where you want it

All you have to do is create an input format without any filters whatsoever. Then, make your block that setting and you will be good to go. Here is the site I did this with:

http://community.teamcovenant.com

Good luck...

Zach

magicflea’s picture

Thanks for the clear and easy to follow instructions. And most importantly, it seems to work properly to feed appropriate Google ads based on your site content.
stephen

neocary’s picture

remv

neocary’s picture

Thank you very much

Ahqar’s picture

Why enable the PHP input format if it's not needed?

Also creating a custom input type for each type of script is unnecessary.

Just create a single input type with all filter settings turned off and call this input format "UNFILTERED".

Here's how:
_____________

Go to the following url

yourdomain/admin/settings/filters

or click the links from the admin section to take you there:

Home > Administer > Site Configuration > Input Formats

Now create a new input type and DESELECT all of the filters for it.

i.e.the following should all be unchecked:

HTML corrector
HTML filter
Line break converter
URL filter

Check the relevant boxes to assign the user that is allowed to use the new "Unfiltered" Input Format and you are done.

Now just select this input format every time you want to paste in third party scripts into blocks or content.

It works with adsense code, Amazon code etc.

Good luck

(By the way I think this input type should be included as standard in all new installations)

jsmart377’s picture

Ahqar,

Thanks for a lifesaver!! I really wanted precise control within my content of where the ads would appear and needed section targeting to work due to the nature of the site requirements.

Was going to great lengthes trying to get the DEV 6.x Adsense Module (11/08/08 rel.)working since global management is much easier. Could not get ads to display until I did as instructed above:

Removed: from "FULL HTML" configuration

HTML corrector
HTML filter
Line break converter

from Home>Administer > Site Configuration > Input Formats

For the "Leaderboard" to display centered just below my content I inserted:

[adsense:728x90:xxxxxxxxx]

(where xxxx is the "slot ID" from Google Adsense site, and also configured in my Managed ad block)

I also have a Managed Ad block configured for this ad type but not enabled for any region (check advanced help with module)

This latest version also has a "click tracking" feature which I am sure will offer more inteligence on where your click traffic originates!

Hope this helps others who may be struggeling with the Adsense Module & Drupal 6.x !

JS

andraeray’s picture

Creating an unfiltered input format did the trick.

Thanks!

I only need to decide if the ad should match my sign design, or if it should purposely look different.
http://www.takenpath.com

jceb3167’s picture

I tried and creating a new input format without any filters to work with Adsense worked perfectly on a nodestream distribution of drupal.

http://www.opttic.com