Currently I’m using the following code to add an in-article advertisement in the first and twentyfirth post and a linkunit in the second post. These are only shown to registered users, and I’ve set in Adsense that ads are only shown to about 50% of the page views (which would still be good for 99% of the revenue).
So far I had none complaints probably due to the fact that they don’t appear to on all sessions and because they are decently integrated.
However, since I use this, Google deducts a fair amount of revenue for invalid traffic/clicks. Possibly because it doesn’t like injecting Javascript as I do. Nevertheless, the revenue is still better than without the ads. And I’ve already lost 60% of ad revenue after switching from Vbulletin to Discourse
I was wondering whether it would be possible to extend the advertising plugin with an advertising slot in the first post. I inject it after the cooked post, and I think that would be an obvious candidate, and simply adding that spot would be sufficient in my idea (although the Linkunit is also a fairly good performing unit). I wonder what happens when the unit is properly integrated with the advertising plugin, will Adsense report less invalid clicks? Only one way to find out
I ask it, because I think it would be a simple addition to the plugin, I hope that is correct and that it can become reality
<script type="text/discourse-plugin" version="0.1">
var inArticle=""; // Define AdUnits in string
inArticle += "<ins class=\"adsbygoogle\"";
inArticle += " style=\"display:block; text-align:center;\"";
inArticle += " data-ad-layout=\"in-article\"";
inArticle += " data-ad-format=\"fluid\"";
inArticle += " data-ad-client=\"ca-pub-xxxxxxx\"";
inArticle += " data-ad-slot=\"xxxxxx\"><\/ins>";
inArticle += "<script>";
inArticle += " (adsbygoogle = window.adsbygoogle || []).push({});";
inArticle += "<\/script>";
var linkUnit="";
linkUnit += "<!-- Discourse - Desktop & Mobile - 2nd post Link Unit -->";
linkUnit += "<ins class=\"adsbygoogle\"";
linkUnit += " style=\"display:block\"";
linkUnit += " data-ad-client=\"ca-pub-xxxxx\"";
linkUnit += " data-ad-slot=\"xxxxx\"";
linkUnit += " data-ad-format=\"link\"><\/ins>";
linkUnit += "<script>";
linkUnit += "(adsbygoogle = window.adsbygoogle || []).push({});";
linkUnit += "<\/script>";
var linkUnitPost25="";
linkUnitPost25 += "<ins class=\"adsbygoogle\"";
linkUnitPost25 += " style=\"display:block; text-align:center;\"";
linkUnitPost25 += " data-ad-layout=\"in-article\"";
linkUnitPost25 += " data-ad-format=\"fluid\"";
linkUnitPost25 += " data-ad-client=\"ca-pub-xxxxxxxx\"";
linkUnitPost25 += " data-ad-slot=\"xxxx\"><\/ins>";
linkUnitPost25 += "<script>";
linkUnitPost25 += " (adsbygoogle = window.adsbygoogle || []).push({});";
linkUnitPost25 += "<\/script>";
if(Discourse.User.current()== null){ // if null, the user is not logged in
api.addPostTransformCallback((t)=>{
if (t.post_number === 1) { // check if we're in post #1
t.cooked = t.cooked + inArticle; // append our advertising div
}
if (t.post_number === 2) { // check to see if we're in post #2
t.cooked = t.cooked + linkUnit;
}
if (t.post_number === 25 || t.post_number === 50 || t.post_number === 75){
t.cooked = t.cooked + linkUnitPost25;
}
});
}
</script>
I think the placement is in post, as most of the blogs are doing right now. It might be nice to have, but very difficult to implement nicely in all the setups. As not all post have enough text and content to make the ad look natural there
@DoMiN8ToR if you show us what you want to achieve with a mock-up, instead of how you think it needs to be implemented we will probably be able to help figure this out.
I hope the distinction between the advertisement and the post is clear. The current one is of the ‘in-article’ type and it’s one of the top performers, so it could boost revenues for many Discourse webmasters. Obviously it could also be some other type.
That’s why inline adverts are more effective. We’ve trained ourselves to tune out visual elements which are too jarring. Advertisers have had to adapt.
The ‘AD’ note is quite standard, not dissimilar to the way Google notates ads in search:
Either way, the ad styling is controlled by the ad code, what we’re trying to figure out here is if an outlet exists to insert adverts into this space.
The outlet I used is right after the cooked post. The advertisement I use is also a format that Google actually markets as InArticle, which would be the first post. There are also the infeed ones, I guess I could use to between nth post as well.
The same position could also be used for any other Adsense format such as responsive one, rectangle, leaderboard etc.
I guess a better question initially would be why your existing Javascript implementation isn’t adequate?
It looks as though you’ve said “I need a thing” and then later “this is what I’ve built already” - you’ve said Google doesn’t like the way you inject JS, but are you sure?
Usually Google objects to any ads they can’t ‘see’ themselves from their crawler processes, you told us that:
Which would support that - do you have any evidence to suggest that Google would be any happier with a different implementation?
Out of curiosity why is it only registered users see adverts? Are you trying to give users the impression they won’t be bombarded with adverts only to find out otherwise once they go to the trouble of registering?
I don’t really have a way to test whether Google dislikes my Javascript, it’s an assumption. But it’s also not the main reason I’m asking. My own numbers show that the advertisement in the first post generates 2.5x more revenue than the other banners (I use the same Adsense Responsive Unit on all slots currently, so I can’t further distinct between locations).
The LinkUnit in the second post, which is outside the scope of this post, but might be interesting to other readers, even generates 4x more revenue.
Regarding the “only shown to registered users”, my apologies I made a mistake there, it should say, only to unregistered users (c.q. guests), this is also what the code shows (it checks whether the current Discourse user is null, and if so, it injects the Adsense code)
I’ve previously tried to understand the Discourse plugin system, but unfortunately I haven’t really had time to get Discourse up and running locally and fiddle with the code myself. With my current knowledge, and that could be totally wrong, I would think the plugin maintainer could also hook to something like the post.cooked part and add that to the plugin, but maybe it’s much harder than that.
Any update with Ads on In article post? Like in other CMS like Joomla, we can add any modules inside a post with a replacement code and on that particular area, the module or ads will render. This feature will be very useful for publishers like us who are solely dependent on Adv revenue.