Is banner module the only way of adding google adsense ads to a block?
I created a new block and added the javascript code but it displays nothing.
Any help will be appreciated.

Thanks
KC

Comments

Dries’s picture

AFAIK, you don't need the banner module at all to add a block with a Google ad.

fnord’s picture

and paste in your code. Here's an example:

http://wireless.eutechitcs.com

Donovan Smith@donovansmith.us’s picture

Make sure you paste all of the adsense code into the block and set the block as HTML. I have it working at http://www.donovansmith.us and haven't had any issues at all with it.

kc’s picture

I think I was missing the last line of the javascript. Now fixed. Thanks to all.

KC
---
Phoenix Real Estate
Add Url
Gift store

hrkaspar’s picture

Actually, I ran in to the same problem upgrading to cvs as of today, september 1st 2004. The block needs to be marked as "PHP code" in order to work.

--
Brgds
Kaspar

Drupal på dansk : http://drupal.tredive.dk/

christina@widgetopia.net’s picture

user error: Duplicate entry '' for key 3

and a bunch of stuff I'm forbidden to post due to its suspicious nature.

What I'm doing: posting all google code directly into a new block.

interestingly enough (or dismayingly enough) my amazon block works okay, but refuses to display the title in the block list. weird.

Both are html, not php.

pmark23’s picture

I'm having a similar problem, except that it works perfectly in Firefox, but not at all in Explorer (even though the code looks right in View Source from Explorer).

This is from a block, set to HTML (PHP returns an error). An Amazon and a stock-ticker block works okay in all browsers.

Anyone see this before? Any workarounds?

Mark

Jim@apathycore.com’s picture

I have Google AdSense working fine on two different sites.

At www.apathycore.com I'm using Drupal 4.4.1, and I have one ad in a block on the right and a banner in the footer. I have also made another block with the Google Search.

At www.chicagojams.com I'm using 4.5.0 cvs and have ads in the "wide skyscraper" format on the right.

On both sites I use the Htmlarea module. To input the AdSense code, I put the htmlarea into "text mode" and paste it in. In both cases, I'm allowing Full HTML - Filtered HTML or PHP don't work.

I've been pretty impressed with how well Google targets the ads, except sometimes on the Chicago Jams site I'll end up with jewelry ads - because it's a music site, the word "band" or "bands" comes up a lot, and Google thinks we're talking about wedding bands.

bradnickel’s picture

Running 4.5 and have input format for script enabled and choose that input format for the block and the ads do not show up. Any ideas?

Brad Nickel
Web Marketing Services
http://www.clickbrain.com
brad@bradnickel.com
877-243-0405

th3gh05t’s picture

Hi,

I have 4.5.1 and i have the banner module. I have tried to confgiure the banner module so that it will show the Google ads, but I have tried and tried, but I could never get anything to come up.

I have tried to insert all of the javascript that Google provides, and change it to 'Full HTML', but I have still had no luck.

Can someone tell us thier settings that they have successfully setup to display the Google Adsense as a block?

Thanks for you time!

th3gh05t

Lam0r’s picture

As stated above by hrkaspar you need to set it PHP. I only experienced this problem with the latest release. My previously installed release was 4.4.2. and I upgraded to 4.5.1 .

CityArchitect’s picture

Yes this is correct. I had the adsense code in 4.4.2 also and it worked fine. As soon as I moved to 4.5 the code failed. Settting it to PHP cured the problem, thanks.

th3gh05t’s picture

So if I set it to PHP, and keep the javascript code or use the banner php code?

Ricky’s picture

So what is solution ?

I tried usin php mode and got parse error

Donovan-at-donovansmith.us’s picture

I have not touched the settings for my Google ad block since I first got it configured. I have re-pasted the code from Google, but it has been set to HTML (and now full HTML) since I first installed the Drupal 4.4 preview release. The javascript code is put in between div tags that has a CSS tag to center the ad in the block and that might be helping. So it goes:

<div style="text-align:center">
Google adsense code from Google's adsense site
</div>

Maybe give that a shot with the mode set to full HTML and see if it helps. I use a regular block for my ad, not the banner module.

Ricky’s picture

Well tried your method !! no gain !
What is happening with me ?

Love Forum :: YoLovers.com

Ricky’s picture

Ok.. so no solution. I am 4.5.0 installed an i m unable to show adsense on it using block !!
Tried above method .. no gain..

Anyone else who has installed drupal recently and is able to run agsense through block !! then please help me out!

Love Forum :: YoLovers.com

bertboerland’s picture

it should be very simple to add a google adsense block. so please give us more information for us to be able to help out. most relevant: what have you done so far (breadcrum wise) what is the code you are pasting,

all i did was
admin
blocks
add (full radio button)
paste code
submit

--

groets


bertb

--
groets
bert boerland

Ricky’s picture

I first created a block.
type full html
then pasted the code
and then activated but
..
Error in page.

Tried in php also and also in filtered html .. no gain !

Love Forum :: YoLovers.com

jweiss’s picture

just wanted to throw my name in there with Ricky on this one. I've been messing with this off an on for a couple weeks. Here's what I've figured out (not much).

Drupal ignores anything that's comented out (so take out the <!-- -->)
For some unknown reason I can call an external file if it's local, but if it's off site (i.e. google) then the entire script is ignored and never passed to the browser.

So far I've tried the Full HTML input option, created a new input option with no filters, PHP filter (and even tried to have it echo the script out to the browser). And, because of this and an error I was having in my forums, I droped every table in the database and started over about 2am this morning. Forums are working, still no google ad block.

Ricky’s picture

Hmm.. ok .. that .. I was also thinking.. ok I am goint to try few thing more and will tell you!

Love Forum :: YoLovers.com

capmex’s picture

Create a new input format and configure it, disable all filters. Use the new input format to insert your adsense code, it should work now.

You can also place the adsense code in your theme's template.
--
Webmaster Resources for Business Websites

terre’s picture

This was my solution also - placing the adsense code in as full html never did work for me. So I created a new input format (no filters applied) and called it "javascript" - make sure that only the admin has access to this input format.

chx’s picture

From the various posts I am 100% sure that the problem is rhat with different OSes and browsers the paste is different, and the line breaks differ. If there is JS code, you definitely do not want to have <br> in the middle.

You need a filter which does _not_ break lines automatically. As some has said, this will be an empty filter... but that's what you need.

--
Drupal development: making the world better, one patch at a time. | A bedroom without a teddy is like a face without a smile.

Ricky’s picture

Hello,

Thanx terre , your trick did the job, Also CHX thanx for your input, actually never thought that way..

!! There is solution for every thing!

Love Forum :: YoLovers.com

Lam0r’s picture

This solved my problem thanks. My adsense was working after I set it to php. But recently I enabled the "Line break converter" in the input formats. Now that messed up my adsense :( and I had no clue what was the cause. There should be a warning I think that says "this feature might cause some code not to function"
thanks