2

I have put the following code from adsense in a block with full html filter.

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- newad -->
<ins class="adsbygoogle"
     style="display:inline-block;width:728px;height:90px"
     data-ad-client="ca-pub-4076687304826472"
     data-ad-slot="1906412748"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

I don't see ads. The message comes with style :"display etc.. and some ads in very unformatted fashion.

Is there some other way to put adsense code in Drupal 7?

2 Answers 2

2

full html isn't always enough to provide the necessary access. go to /admin/config/content/formats and create a new format (I call mine 'Unaltered') with the following setup (make sure to restrict it to admin ONLY):

This will allow you to perform inline js, etc within a block, without requiring a new module. Also, make sure the style listed in the js you include matches the size of the block (or more accurately, that the block matches the size of ad you want to show), or you will have strange layouts where the ad doesn't fit the container.

enter image description here

0
0

As usual, there is AdSense module developed to take care of it.

This module provides web content providers with the means to earn revenue from visitors by displaying ads from Google AdSense™ advertising service on their sites.

Why should you use it:

  • The module provides easy-to-use ad blocks.
  • Provides simple controls for troubleshooting the ads before going live with the site.

List trimmed by me, of course.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.