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:
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.
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.
Current limitations require you to set a very permissive policy using the
content_security_policy_script_src site setting. See below:
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.