This commit adds 2 new settings to house ads to control whether an ad is shown to anonymous users and logged in users. Existing ads that were created before this feature will default to true for both settings; i.e., they will remain to be visible to both anonymous and logged-in users, but it will be possible to change the settings. Turning off both settings will effectively disable the ad completely.
We expose the ad-slot logic to determine which ads are potentially available for each slot and don't render the connector when there are none. Leaking the component logic is not ideal, but I don't see a better solution given the
current design.
The code-review plugin overrides the core's topic-list template, which makes all the connectors for the outlets there stop working. I'm temporarily skipping this assertion until we remove the override.
* init
* more
* Pass td and colspan to component
* various fixes for house ads between n topics and add a test
* Make adComponents condition easier to read
Co-authored-by: Jordan Vidrine <[email protected]>
Co-authored-by: Penar Musaraj <[email protected]>
Co-authored-by: romanrizzi <[email protected]>
The tests were using an incorrect value for the site setting (the name of the group instead of the id).
`no_ads_for_groups` shows groups names in the UI byt actually stores IDs.
Ad networks that serve javascript files won't work unless CSP is
disabled (a bad idea), or the content security policy script src
site setting is updated to include all sources of permitted
javascript. We will keep instructions up-to-date in the first post
of this topic: https://meta.discourse.org/t/33734
* DEV: Stop loading external scripts while running tests
* Revert "Turn of CSP for tests"
This reverts commit db1bf99277. It had no effect, since CSP is set by the server, and this was only affecting the client
getWidthAndHeight was being called twice for each ad placement:
once when setting the size of the div, and once when calling the
defineSlot API. getWidthAndHeight always advances to the next size
in the list, so the wrong size ad would be inserted into the div.
Each ad placement in the AdSense and Ad Manager settings takes a list
of ad sizes instead of only one size. If given multiple sizes, the sizes
will alternate in order for each ad that's rendered.
Ember is firing events multiple times when the ad component is shown.
Only solution I can find is to add a delay between calls to refresh
the ad unit. I chose 3 seconds.
If you want to use one Ad Manager publisher on desktop and a different
one on mobile, use the new dfp_publisher_id_mobile setting.
By default, dfp_publisher_id will be used for both desktop and mobile.
Hidden tags aren't sent to the client, so they couldn't be used to
disable ads on topic pages. Do this calculation on the server.
Topic list pages for tags can continue to check on the client because
non-staff get a 404 error when trying to view a hidden tag's topic list.
Enter a list of tags in the new setting no_ads_for_tags to prevent
ads from being rendered on topics with one or more of those tags,
and on topic list pages for those tags.
DFP category targeting param wasn't always being updated on topic
list pages.
Also remove dependency on a category param being passed in to the
component from a template so that we can now place dfp ads
in places that don't have access to the current category and
targeting will still work.
Official Plugin Topic & Documentation: https://meta.discourse.org/t/official-advertising-ad-plugin-for-discourse/33734
This is the official Discourse advertising plugin. It allows advertisements to be served by supported advertising platforms for users with a Discourse forum.
This is the official Discourse advertising plugin. It allows advertisements to be served by supported advertising platforms for users with a Discourse forum.
* [Google Double Click for Publishers](https://www.google.com/dfp)
* [Google Double Click for Publishers](https://www.google.com/dfp)
* [Amazon Affiliates](http://affiliate-program.amazon.com) - Banner and Product Link Ads
* [Amazon Affiliates](http://affiliate-program.amazon.com) - Banner and Product Link Ads
* [CodeFund](https://codefund.io) - Ethical Ad Platform for Developers
* [Carbon Ads](https://www.carbonads.net/)
* [Carbon Ads](https://www.carbonads.net/)
* [AdButler](https://www.adbutler.com/)
## Quick Start in 3 Steps
## Quick Start in 3 Steps
@@ -34,7 +36,7 @@ For non-docker or local development installation (those with programming experie
### Step 1 - Install the Official Discourse Advertising Plugin
### Step 1 - Install the Official Discourse Advertising Plugin
As seen in a [how-to on meta.discourse.org](https://meta.discourse.org/t/advanced-troubleshooting-with-docker/15927#Example:%20Install%20a%20plugin), simply **add the plugin's repository url to your container's app.yml file**:
As seen in a [how-to on meta.discourse.org](https://meta.discourse.org/t/install-plugins-in-discourse/19157), simply **add the plugin's repository url to your container's app.yml file**:
```yml
```yml
hooks:
hooks:
@@ -79,8 +81,8 @@ the ad slots. The ads will start showing as soon as you add them to slots.
<li>House Ads - if you want to create and serve ads from your Discourse instance.</li>
<li>House Ads - if you want to create and serve ads from your Discourse instance.</li>
<li>Adsense - if using Adsense as your advertisement platform.</li>
<li>Adsense - if using Adsense as your advertisement platform.</li>
<li>DFP - if using the DoubleClick for Publishers advertisement platform.</li>
<li>DFP - if using the DoubleClick for Publishers advertisement platform.</li>
<li>CodeFund - if using the CodeFund ethical advertisement platform.</li>
<li>Carbon Ads - if using the Carbon Ads advertisement platform.</li>
<li>Carbon Ads - if using the Carbon Ads advertisement platform.</li>
<li>AdButler - if using the AdButler advertisement platform.</li>
</ul>
</ul>
</ul>
</ul>
@@ -94,24 +96,47 @@ the ad slots. The ads will start showing as soon as you add them to slots.
##### Adsense Advertisement Tag to Discourse's Site Settings
##### Adsense Advertisement Tag to Discourse's Site Settings
##### AdButler Ads Zone URL to Discourse's Site Settings
This plugin only support AdButler "Standard Zones". Text and VAST are not supported.
If you browse to a zone in the AdButler admin, then you can find the Publisher ID (PPPPPP) and the Zone ID (ZZZZZZ) in the URL of your browser's address bar:
Enter the publisher id in the "adbutler publisher id" setting, and enter the Zone IDs in the different
zone id settings as desired.
By default, ads are assumed to be size 728 x 90, or 320 x 50 in mobile view.
To use different size ads, customize using CSS in your site's theme. Override the following CSS:
```css
.adbutler-ad {
width: 728px;
height: 90px;
}
.adbutler-mobile-ad {
width: 320px;
height: 50px;
}
```
### Step 3 - See Your Ad
### Step 3 - See Your Ad
@@ -122,9 +147,11 @@ Once you've configured your settings and your advertising platform has ads that
In this section, we go into more detail on:
In this section, we go into more detail on:
* Available Locations for Ad Display
* Available Locations for Ad Display
* Ad Sizes Supported
* Trust Levels
* Trust Levels
* Languages Supported
* Personal messages
* Groups
* Categories
* Tags
### Available Locations for Ad Display
### Available Locations for Ad Display
@@ -137,26 +164,7 @@ The following are available locations along with a description and an image show
| Topic Above Suggested | Ad will appear in the footer above suggested topics of all Discourse forum topics |
| Topic Above Suggested | Ad will appear in the footer above suggested topics of all Discourse forum topics |
| Post Bottom & Nth Post | Ad will appear on the stipulated nth post within a topic. So if you have 5 posts in a topic and you want the ad to display after on the 2nd post, put 2 in ```ad_platform_nth_post_code```. |
| Post Bottom & Nth Post | Ad will appear on the stipulated nth post within a topic. So if you have 5 posts in a topic and you want the ad to display after on the 2nd post, put 2 in ```ad_platform_nth_post_code```. |
This plugin supports the following ad sizes for the following locations.
All locations except post bottom | Post bottom location | Mobile
--- | --- | ---
728 x 90 | 728 x 90 | 320 x 50
336 x 280 | 336 x 280 |
300 x 250 | 300 x 250 |
970 x 90 | 970 x 90 |
468 x 60 | 468 x 60 |
234 x 60 | 234 x 60 |
125 x 125 | |
180 x 150 | |
200 x 200 | |
250 x 250 | |
### Trust Levels
### Trust Levels
@@ -170,12 +178,21 @@ You can use the ```ad_platform_through_trust_level``` dropdown to disable ads fo
To find more about trust levels in Discourse, refer to [Discourse's posts on trust levels](https://meta.discourse.org/t/what-do-user-trust-levels-do/4924)
To find more about trust levels in Discourse, refer to [Discourse's posts on trust levels](https://meta.discourse.org/t/what-do-user-trust-levels-do/4924)
### Languages Supported
### Personal messages
* Chinese (Simplified)
By default, ads won't be shown in personal messages. To enable ads in personal messages, use the "no ads for personal messages" setting.
* English
* French
### Groups
* Spanish
To give some users an ad-free experience, put the users in groups and add those groups to the "no ads for groups" setting.
### Categories
To disable ads in certain categories, add them to the "no ads for categories" setting. Also consider using the "no ads for restricted categories" to disable ads in all categories that have read access restrictions.
### Tags
Individual topics can have ads disabled by using tags, and entering those tags in the "no ads for tags" setting. This is useful if some topics violate ad network policies.
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.