I can't see Google Adsense ads. I put on my id. I see the placeholders, everything is enabled. I didn't put "hide adsense" on for anonymous, but i don't see any ads through another browser.

For some reason, unlike in 5.x version, there are no list of Blocks automatically generated in Blocks menu. So apparently, that's a bug.

I had to create my own block, using [adsense] tags, and I put in 1 for group, whatever that means, because groups don't exist in adsense so not sure what it is. And then the channel ID.

But nothing is displayed, except for Admins "placeholder" is displayed.

Comments

executex’s picture

Anyone?

kbahey’s picture

Status: Active » Closed (works as designed)

User 1 does not see the ads by default. This is documented in the help.

Logout and you will see the ads.

executex’s picture

Priority: Normal » Critical
Status: Closed (works as designed) » Active

I told you I am using another browser as well (it means I'm NOT logged in)... NO ONE sees ads.
Hide adsense is not activated.
I put in a blog like this:
[adsense:468x60:1:3453234553]

And it simply doesn't show. I can see placeholders but no ads, even when I log out.

kbahey’s picture

Status: Active » Postponed (maintainer needs more info)

Try creating a new block and pasting the ad code from your google account as it is.

See if that ad displaying anything. If not, then it is a google issue not a module issue.

If it works, then try enabling the managed module and enabling one of its blocks. If that works then perhaps the tag is misconfigured.

executex’s picture

Ok It worked.
I had to use PHP Filter to display the block.
Using FULL HTML made this:

<!-- And I definitely used your instructions to make my tags, so I dont see how anything could go wrong. I use the adsense tag, even enabled "Adsense tag" in Input Filters. But it shows the text [adsense:.........] in pure plain text, including in the View Source. I put the block in content top, with title "t" and here's how it looks in HTML:

t

I guess the tag didn't work at all. I can see the ad only when i type in the Google code from Google in pure PHP form.
philsward’s picture

I bet anything that you have lightbox installed... On D6, I have run into this problem on more than one site and almost pulled my hair out to figure out what the problem was... finally realized it was lightbox.

I placed an issue into the lightbox2 queue for them to take a look at it further: http://drupal.org/node/357916

Basically, Lightbox is injecting a rel="lightbox" at the end of the adsense javascript code.

I also placed a workaround in the link above that works for blocks and anything where you can afford to specify a stripped down html input filter.

----

Update: Lightbox is NOT the issue... (don't I feel stupid...) See the following post (and comment #8 below) for more info: http://drupal.org/node/357916

smcclendon’s picture

I do not have lightbox installed..... unless it was installed with the initial install.... I am very new to Drupal, and would appreciate some help. My Adsese ads are also blank. I am running the Drupal 6.8 in probably its most basic form.

I have created a box just for the adsense code...and its running in my footer....but its blank.

www.surmiseit.com

Any help?

Stephen

philsward’s picture

Well, I might have been premature on the lightbox thing... I am in the process of testing it now and I think it is actually the: HTML corrector filter that is causing the problem.

I currently have a custom input filter called Adsense HTML with all filters unchecked except:
AdSense tag and
Line break converter

As soon as I enable the HTML corrector filter, the ads disappear...

I personally am not using the 'Managed Ads' but the old legacy code that allows the [adsense:200x200:1:0] input format.

Ok, I finished my testing and found that the Lightbox module, while it IS injecting rel="lightbox" through the Lightbox G2 filter, it doesn't look like Lightbox is causing the issue (It's been a long day and I was feeling a bit lazy to test it further earlier I guess...)

SO, in response to fixing your problem, create a new input filter and make sure the following are unchecked:
HTML corrector
HTML filter
PHP evaluator

The reset of the filters "should be ok". If you still have problems, try unchecking everything except:
AdSense tag
Line break converter

-----

Have you created a new role and called it something like admin user or administrative user?
If not, it is a good practice to do so, then add your 'admin user' to the 'admin role' and grant all permissions to the admin role.

You might also install Adminrole which helps keep all newly installed modules up to date with the permissions for your admin role. (it works great but still isn't perfect)

-----

I took a look at the site and noticed that you are using the blocks that are pre-defined with the adsense module... those are going to be a different problem than my suggestion above. I don't know what to say because I noticed that the code is all in-place and should be working fine...

executex’s picture

I did what you asked, made my own adsense filter. Removed HTML corrector and everything except Adsense tag.
Nope doesn't work.

There is some huuuuuuge error with Adsense 6.x-1.0-beta3, that the maintainer needs to fix. This is not my fault, I am an experienced web developer, I shouldn't have this problem, I followed all instructions. Obviously Adsense module is currently broken.

kbahey’s picture

Title: Can't See Ads » Adsense ads using tags do not work
Priority: Critical » Normal

Changing the title to reflect what the issue is ...

Which adsense modules do you have enabled?

The new format is this:

[adsense:format:slot]

Are you sure you are using a valid slot?

executex’s picture

[adsense:468x60:XXXXXXXXXX]

Yep I am using it correctly. There is a number for the slot ID, that's what I used.
It's not displaying the adsense tag, to non-admins.
To administrator (user ID 1) it's displayed a placeholder "google adsense banner".

However, to anonymous users, it displays nothing, not even a single piece of html. It's like as if it's disabled for anonymous users.

executex’s picture

Are you unable to recreate the problem?

Also, maybe this helps: When I enable "Test mode", Google adsense placeholder disappears, and you can't see any hint that the module is active anywhere except administration.

Also, as I analyzed your code... I found... that If I COMMENT this code:

sscanf(VERSION, "%d.%d", $major, $minor);
  if (($major == 6) && ($minor <= 99)) {
    $text = preg_replace('/<!--.*?-->/', '', $text);
  }

When I am anonymous it now displays this comment in the html, this is very new:

EDIT PROGRESS:
When I enable "managed_ads" module it displays ads now. The tags work again.
Apparently, there is a logic error with if/else statements leading to a blank area, and the HTML corrector fix is also messing it up.

kbahey’s picture

I am trying to reproduce it on a test site.

kbahey’s picture

Status: Postponed (maintainer needs more info) » Needs review

Yes, that was it.

I removed that section since no one is supposed to be running insecure old versions.

Committed to 6.x-1.x-dev, which will be available with the change in about 8 hours from now.

You can download that -dev release and use it tonight or tomorrow.

executex’s picture

Status: Needs review » Postponed (maintainer needs more info)

Yep, so you gotta (1) Make Adsense tags work without module_exists('managed_ads'); and (2) Maybe fix the html code, the preg_replace looks weird as heck, it looks like it deletes all the stuff between

.

kbahey’s picture

Status: Postponed (maintainer needs more info) » Needs review

I committed the fix. It works without managed being enabled.

Please review and mark as fixed or need work after the tarball is built.

jcnventura’s picture

Status: Needs review » Needs work

Some notes on this.. The check is for Drupal versions less than 6.99 and it's still applicable (even if I never updated the comment).

It's necessary to remove the contents of HTML comments in Drupal 6 with the HTML corrector enabled because of #222926: HTML Corrector filter escapes HTML comments. This HTML corrector bug makes the contents of the comment visible, and this made some comments in Google's code show up (see my #12 comment in that issue).

Obviously, if this creating problems in some situations, then we need a better pattern in the preg_replace and some extra checks in a way that it only prevents the HTML corrector bug..
Since the HTML corrector bug is enabled by default, the code needs to be able to circumvent the problem until the other issue is fixed).

João

kbahey’s picture

Not everyone will have htmlcorrector installed.

What I recommend is either:

1. Wrap this condition in if(drupal_module_exists('htmlcorrector')) { ....
Or
2. Display a drupal_set_message() if htmlcorrector is installed and say that they are conflicting.

The way it is done now is invasive.

jcnventura’s picture

kbahey,

I agree with you.. A warning in the admin pages about the incompatibility between adsense tags and HTML corrector could be displayed so that users are aware of the problem. This would work a lot better than removing the comment.

Note however than this is not about module_exists('htmlcorrector')... That's only applicable to Drupal 5. Drupal 6 has the HTML corrector in core as an input filter that is enabled by default. However, there should still be someway to detect if it is currently enabled...

João

kbahey’s picture

Status: Needs work » Active

@jcnventura

I missed that it is in core. My mistake.

It seems that everything works when the "managed" module is enabled.

If not, then there is an error message adsense: no AdSense for Content module found, and it is enclosed in HTML comment tags. But since the code that removes the tags is there, the entire error message is stripped and there is no clue for the user to enable managed or some other content module.

So, how do we go about solving this?

jcnventura’s picture

I take it for granted that the 'preg_replace to remove all the comment' approach is no longer desired because of it's side effects.

The final solution, of course is for the #222926: HTML Corrector filter escapes HTML comments issue to be solved and released (in Drupal 6.9?).

As an interim measure, one could write a adsense_nodeapi, and on the "prepare" action, check if the HTML corrector and the adsense input filters are enabled and display a warning message that adsense tags are not compatible with the HTML corrector.

João

smcclendon’s picture

Sorry guys, I'm still completely lost here.... to run the Adsense ads correctly, do I need to install an Adsense Module?

Why is it that I can't just paste the adsense html in a block?

Sorry for the ignorance.

www.surmiseit.com

jcnventura’s picture

You can indeed just paste the HTML in a block..

The trouble starts mostly if you also want to use AdSense for Search which has a conflict with Drupal's use of the 'q' query parameter. In that case, it's much simpler to just use this module.. However, it's also a lot easier to just paste Google's slot ID into the blocks provided by this module and to take advantage of the other 'services' provided (like disabling of the ads if you're logged in as site owner and the check for maximum number of ads in a page).

João

jcnventura’s picture

Status: Active » Fixed

OK.

I have deleted the HTML comment removal code, and replaced it with a warning message in the input filter configuration forms where the user is warned that the AdSense tags and HTML corrector filters are incompatible and disabling the HTML corrector is recommended.

That should fix the problem.

João

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mustafa.ata’s picture

Title: Adsense ads using tags do not work » Solution worked for me using adsense short tags
Version: 6.x-1.0-beta3 » 7.x-1.1
Issue tags: +Adsense Adsense tags

The solution which worked for me is that I enabled the adsense tags and then used this format to show ads on the site. Actually I was getting Ads disabled for admin and for other users i was getting the empty ad with space occupied on page but nothing shown. After different tweaks and experiments I got the following code working for me

[adsense:336x280:XXXXXXXXXX]

2nd parameter is width x height
3rd parameter: XXXXXXXXXX denotes the google ad slot/id.

I hope this will help others.

Ata ul Mustafa