By forrestbao on
Hi,
I had a problem on embedding Javascript into HTML content in Drupal.
I tried to create a block whose content is the Google Adsense code generated at Google Ads website.
But I found that this block didn't display anything after I enabled it and placed it on the left banner.
I also tried to publish a content containing some text with this Javascript code. But nothing was displayed, except pure text part.
Drupal Module Adsense is also tried by me. But nothing was displayed except a black border with black text "Google adsense" inside.
Can anyone tell me why the Javascript doesn't run in my content? How can I enable it?
Comments
The Google AdSense module is
The Google AdSense module is actually working. It just shows the placeholder for your admin account. Logout and you should see the ads.
Regarding the JS issue, did you change the input format to full HTML? In filtered mode it will filter out any script tags you put in the body.
----------------------
Drupal by Wombats | Current Drupal project: http://www.ubercart.org
Oh, yeah, Google Adsense
Oh, yeah, Google Adsense module works.
I found it didn't work when I wanna create a block only containing Adsense code. I don't wanna use the Adsense module.
Even if I enabled Full HTML, it still doesn't work. I have made it work before. But this time, it fails. I don't know what's wrong. Do you think any else place I need to configure to make Javascript work?
Forrest Sheng Bao
http://forrest.bao.googlepages.com
same problem here
I am having the exact same problem, I want to have a get firefox referral ad in my site, like the one on http://baheyeldin.com/, which is the site of the adsense module creator. I make a block set it to full html and pasted the script generated by google, then I enabled the block and now more than 12 hours have passed and still nothing. I have tried looking at the site from another computer and it still doesn't work. My site is www.mulpo.com
Nicolas
-------------------------
bump
Anyone knows why google JavaScript is not working. Some help would be really cool!
Nicolas
-------------------------
only with image ads
I used the JavaScript for text ads and it works perfectly. But the image ads for any of Google products doesn't work!!! Help please!!!!!
Nicolas
-------------------------
not a problem with Drupal
I just tested google ads in a html page in server and only text ads display and no image referral ads. I guess Google Adsense setup for image ads is down????????
Nicolas
-------------------------
it is the filters problem
I have found the problem. Try to select "Input Format" as "PHP code". Then it may work fine. Might because "Filtered HTML" and "HTML" option filtered some tags.
Forrest Sheng Bao
http://forrest.bao.googlepages.com
yeah it wasn't a problem
yeah it wasn't a problem with that, the image from Google where down for a few days.
Nicolas
-------------------------
Still can't see Google Adsense ads
found the Solution
So What is the Google Adsense / Referral Ad Solution?
So, how did you fix it?
I placed by Google Referral ad code into a block, but nothing shows up - even when I am logged out.
I even changed the input to full html (have yet to try the php suggestion above).
Any suggestions?
Nevermind, It's Working Now
don't know what I did different, but its working.
images down
I think that for some reason the images in the server where down. I made a test of a simple html page on my server with the google code for one image and one text ad. At first only the text one would appear, but I checked the same page again after a few days, and it was working.
Nicolas
-------------------------
http://nic.ipwa.net
Nicolas
-------------------------
re: google adsense javascript doesn't work, no ads displayed
I find that when I take the Google adsense code, I create a block for it, making sure to set the input type to PHP then I need to disable rich text (if you have that option) then paste the google code and save, it works fine.
I think it's a filter problem...
If I create a new block unit, put the adsense code, and save al Full HTML code, when I have a look at source's code of my page I found this:
<script type='text/javascript'> <!--google_ad_clientNot this code:
<script type='text/javascript'> <!--google_ad_clientThe problem is with
<!characters that are filtered... I'm using Drupal 6 RC1 and I'm trying to create a Adsense content using Full HTML...Bye
i am having the same
i am having the same problem
can anyone help me out?
Thanks
Old and new output
The old Adsense output works fine, while the new one with the fancy encryption for your settings, is not working in a block frame. So I use the old code.
add me to the list too
add me to the list too simple cut and paste of adsense new code into a block will not work. I am hoping a 6.0 version of a adsense Module comes out soonish.
You can do like this:1)
You can do like this:
1) login as administrator -> Modules -> Enable php input format.
Now while writing page/ story/ block -> select php as input format.
This will solve your problem.
http://www.techhunt.org
I work at Drupar.com
Thanks, that worked for me.
Thanks, that worked for me.
I think might be html filter
I think might be html filter bug on drupal 6.x, I've used php code block (worked).
Simple Fix without enabling PHP
So the issue in Drupal 6.2 and Google ads in blocks is the "Full HTML" input format. "Full HTML" input still has the HTML filter enabled. The HTML filter strips/disables javascript.
All you have to do is make a new input format (I called it Raw HTML) and don't turn on any filters. I also only allow the admin to use this input format.
That's it. You don't need to enable the PHP input format at all. Be sure to go back to your blocks or page bodies and change the input format to the "Raw HTML" format to enable the javascript.
New Input Type fixed the problem
Ya, creating a new input filter type and using it when creating custom blocks works!!!
see: www.marinactivities.com
Thanks for the help.
Log in as administrator -->>
Log in as administrator -->> Go to admin panel -->> modules -->> Enable php.
Now while adding content to blocks or to any page/story.....just select php as input format type.
http://www.techhunt.org
I work at Drupar.com
Same Issue
I'm having the same issue. One thing that I've noticed is that the google code doesn't work if you compress it to one line
for example, it works like
[ < script type="text/javascript">
but not with the same code that's like
< script type="text/javascript">
does anyone know how to disable the automatic cleaning / filter when submitting content so it won't automatically compress the lines together?
No module needed to get this
No module needed to get this to work.
Just add a new input format, don't mark any checkbox and apply it.
Make it a normal html file and it will be fine.
what about put it on the block
what about put it on the block? i'd try to add new type format but it's still displayin nothin..
it happen in php format type too.
You have to add adsense code
You have to add adsense code in the block. Make title of the block
Select input format as "php". Now enable the block, and wait for 15 mins..because adsense code take around 15 min. to appear.
Free Drupal Themes || Free Wallpapers
I work at Drupar.com
Its very simple in drupal 6
from admin/module/ enable php module
While composing the page or story...
Enable input option: php code
and in between a page or story, add this:
start writing some more stuff here...if u want....
Hope this helps!
Drupal 6x and Adsense - For the win!
The above person is right. I figured this out too. I wrote down step by step instructions for all to look at here: http://computerquestionhelp.com/blogs/Misc/getting-google-adsense-to-eas...
Good luck on Drupal 6x
:)
Easy Fix -- here's how I did It
Every time I looked at the source code, I was finding that the start comment was changed to "< ; !--"
I had full HTML filter as the input type.
I went to site configuration and created a new input type called Google Ad Sense (name doesn't matter, but I wanted to remember what I was using it for). I didn't check any user role for permissions (don't want this showing but to anybody but me when I'm logged into the primary admin account). Then I DID NOT select any of the other input types in my configuration.
In other words, it's a completely black input type.
Simple solution worked for me
Hello,
I was also having the same problem:
"Every time I looked at the source code, I was finding that the start comment was changed to "< ; !--"
I used HTML and FULL HTML as input format. I just rearranged the filter ordering from the Full HTML input format to this
URL filter
Line break converter
HTML corrector
AdSense tag
I think the HTML corrector filter was changing "<" for "<" therefore putting adsese tag after it solved the problem.
It Worked for me, I don't know if it will work for everyone, but try it before changing to php or trying any other more complicated solutions.
Cheers!
Simple Solution
After reading many of the posts/comments the simplest solution is this:
I got this fixed on my system by going to
administer->site configuration->input formats and then clicking on configure for Full HTML and UNCHECKING the HTML corrector option. Save and your good to go!
Show on edit node but not when view node
My case is a little bit different.
If I view the node, no google ads shows but if I edit the node, the ads show up.
Although I set these ads block appear always.
In addition, under admin/* there are pages the ads show and there are pages that no ad is shown.
Kind of weird issue.
Any one help is very much appreciated.
Solution worked for me.
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
use php instead of full html
use php instead of full html in the text format, worked perfect for me copying and pasting the adsense code straight into the section/field of the page. Check out my site here http://sweepsandnews.com/
You know how you can have
You know how you can have filtered html, Full html well there's an option for PHP but first you have to enable php within your modules to utilize that. That's probably your issue.