# AdSense Responsive Ads

**URL:** <https://meta.discourse.org/t/adsense-responsive-ads/63991>\
**Category:** Product Support\
**Tags:** advertising\
**Created:** [5 juni 2017 om 21:02 UTC](https://meta.discourse.org/t/adsense-responsive-ads/63991 "2017-06-05T21:02:06Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)\
**Post date:** [5 juni 2017 om 21:02 UTC](https://meta.discourse.org/t/adsense-responsive-ads/63991/1 "2017-06-05T21:02:06Z")

</div>

> ⚠ **IF YOU ARE RUNNING AN AD BLOCKER RIGHT NOW YOU WILL HAVE A _VERY BAD TIME_ TRYING TO SET THIS UP!** TURN IT OFF BEFORE PROCEEDING DOWN THIS PATH! You’ve been warned. 🐉

Google AdSense offers the option to show ads with a size of Google’s choice using the **responsive** ad size option.

> ⚠
> 
> **Note that responsive ads are an all-or-nothing option.** You can’t limit the height and width of them. They will cause jumpy behaviour when scrolling within a topic.
> 
> It is recommended to **use fixed size ads** instead.

## Defining your AdSense ad units

Simply define your ad unit(s) in AdSense using the responsive option:

 ![](https://global.discourse-cdn.com/meta/original/3X/3/2/322ebd8ce5b3b5930810676afdd960a24328e6c4.png)

It can take a few hours before AdSense has any inventory to show in the ad unit, so it’s useful to define some fallback creative in the “ **If no ads available** ” field to verify that the ad unit is working and to see which ad sizes AdSense is choosing.

Once you create the ad unit, it will show up in your ad units list with a numbered ID. You’ll need the ID to enter in Discourse.

## Discourse Settings

On your Discourse instance, go to **Admin \> Settings \> AdSense**. Enter your publisher ID as usual (the number after `pub-`), enter the ad unit ID in the location(s) where you want it to appear, and choose “responsive” as the size.

 ![](https://global.discourse-cdn.com/meta/original/3X/f/4/f4e160892d8f3471b9bb413bbdf479be38a4251d.png)

Current limitations require you to set a very permissive policy using the `content_security_policy_script_src` site setting. See below:

> [@Mitigate XSS Attacks with Content Security Policy](https://meta.discourse.org/t/mitigate-xss-attacks-with-content-security-policy/104243/3):
>
> If your site uses an advertising service (like Google Ad Manager, Adsense, etc.) you probably will have to use a very permissive policy:
> 
> ![image.png](https://global.discourse-cdn.com/meta/original/3X/3/5/35741fb9a1b5d9bd8abcb63e079894e97a25232f.png)
> 
> In the screenshot above, the policy allows any script from a `https:` source and any inline script. (In the future, this might be replaced by the [strict-dynamic](https://csp.withgoogle.com/docs/faq.html) keyword, but as of this writing, `strict-dynamic` isn’t supported by Safari or Edge.)

## Controlling Ad Sizes

There is no way to control responsive ad sizes anymore due to changes made by Google. See discussion later in this topic.

---

_[View the full topic](https://meta.discourse.org/t/adsense-responsive-ads/63991)._
