Vikas_Dangi is trying to add Google Auto Ads code to the </head> section of every topic in their Discourse forum. They have tried adding the code to the theme’s head section, but only the first script is showing in the source.
SidV suggested adding the code through the admin panel, but Vikas_Dangi is having trouble with the second script not showing up.
codinghorror noted that whitelisting the external domain for Content Security Policy (CSP) is required, but Vikas_Dangi is unsure how to do this.
devzero pointed out that Discourse may be stripping out the inline JavaScript, and neil expressed concerns about implementing Auto Ads with Discourse, citing a lack of documentation.
Vikas_Dangi requested that Auto Ads be added to the Discourse Ads Plugin, allowing for more customization. charleswalter suggested forcing a refresh of the Auto Ads JavaScript on every page load, but neil remains unclear about the feasibility of implementing Auto Ads with Discourse.
Note that you still have to whitelist the external domain for CSP if this is a new install of Discourse, as CSP is mandatory on all new installs. CSP will be mandatory on all installs once 2.3 is released as well.
It’s a great solution, but not customizable. Every user on every page of the forum will face the code.
I want it to work like Discourse Advertisement Plugin, where you can choose user groups who can see ads and where. I prefers users below trust level 2 and only on topics where the content is enough to serve ads.
@codinghorror It will be great if this auto ads also added to Discourse Ads Plugin.
I’m not convinced that auto ads can work with Discourse. I can’t find any documentation about this, so maybe it’s possible. If you can point us to documentation about how to implement it with single page apps/infinite scroll, then we can try it.
The ad plugin handles AdSense and Ad Manager by using their APIs to request ads be rendered and updated, but I don’t see how that’s done with Auto Ads.
@neil, is there no way to just force a refresh of the auto ads javascript on every “page” load?
I guess it would struggle handling the ads when scrolling more replies, but other than that, it does look like an interesting solution. I wonder if it can be used in combination with traditional adsense placements.