NodeBB and ads - A never ending story (Part 2)
-
-
- If we get the DFP to work, is it possible to add adds in the first post of every thread? Header and footer is solvable with widgets.
- It must be a way to skip the modify of /public/src/ajaxify.js (function renderTemplate): Is it possible to merge the change to core in a good way? What are the downsides of modifying ajaxify.js?
@AOKP Can I see your webpage, url? Nice to see how you have solved the ad placements
-
@Jenkler yes, even without DFP this is possible. I personally discourage from doing so and recommend to use an after first post ad placement.
None. No functionallity will be broken or affected by the modification. However, as @PitaJ suggested it can be done as well by a simple header code.
My NodeBB forum:
https://forum.meizufans.eu@PitaJ & @baris, this is how the recent DFP code looks like:
Header code:<script async='async' src='https://www.googletagservices.com/tag/js/gpt.js'></script> <script> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; </script> <script> googletag.cmd.push(function() { googletag.defineSlot('/275425923/AdX_Footer', [[970, 250], [336, 280], [728, 90], [970, 90]], 'div-gpt-ad-1476529722718-0').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Footer_Mobile', [[320, 100], [300, 250], [320, 50]], 'div-gpt-ad-1476529722718-1').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Mid', [[336, 280], [728, 90], [970, 90]], 'div-gpt-ad-1476529722718-2').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Mid_Mobile', [[320, 100], [300, 250], [320, 50]], 'div-gpt-ad-1476529722718-3').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Post', [[336, 280], [728, 90], [970, 90]], 'div-gpt-ad-1476529722718-4').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Post_Mobile', [[320, 100], [300, 250], [320, 50]], 'div-gpt-ad-1476529722718-5').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Side', [[160, 600], [300, 250], [300, 600]], 'div-gpt-ad-1476529722718-6').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Top', [[336, 280], [728, 90], [970, 90]], 'div-gpt-ad-1476529722718-7').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Top_Mobile', [[320, 100], [320, 50]], 'div-gpt-ad-1476529722718-8').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.pubads().collapseEmptyDivs(); googletag.enableServices(); }); </script>
Body code (ad units):
<!-- /275425923/AdX_Footer --> <div id='div-gpt-ad-1476529722718-0'> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-1476529722718-0'); }); </script> </div> <!-- /275425923/AdX_Footer_Mobile --> <div id='div-gpt-ad-1476529722718-1'> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-1476529722718-1'); }); </script> </div> <!-- /275425923/AdX_Mid --> <div id='div-gpt-ad-1476529722718-2'> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-1476529722718-2'); }); </script> </div> <!-- /275425923/AdX_Mid_Mobile --> <div id='div-gpt-ad-1476529722718-3'> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-1476529722718-3'); }); </script> </div> <!-- /275425923/AdX_Post --> <div id='div-gpt-ad-1476529722718-4'> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-1476529722718-4'); }); </script> </div> <!-- /275425923/AdX_Post_Mobile --> <div id='div-gpt-ad-1476529722718-5'> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-1476529722718-5'); }); </script> </div> <!-- /275425923/AdX_Side --> <div id='div-gpt-ad-1476529722718-6'> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-1476529722718-6'); }); </script> </div> <!-- /275425923/AdX_Top --> <div id='div-gpt-ad-1476529722718-7'> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-1476529722718-7'); }); </script> </div> <!-- /275425923/AdX_Top_Mobile --> <div id='div-gpt-ad-1476529722718-8'> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-1476529722718-8'); }); </script> </div>
Here how the header code looks like with synchronous rendering:
<script> (function() { var useSSL = 'https:' == document.location.protocol; var src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>'); })(); </script> <script> googletag.cmd.push(function() { googletag.defineSlot('/275425923/AdX_Footer', [[336, 280], [970, 90], [728, 90], [970, 250]], 'div-gpt-ad-1476529786566-0').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Footer_Mobile', [[320, 50], [320, 100], [300, 250]], 'div-gpt-ad-1476529786566-1').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Mid', [[336, 280], [970, 90], [728, 90]], 'div-gpt-ad-1476529786566-2').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Mid_Mobile', [[320, 50], [320, 100], [300, 250]], 'div-gpt-ad-1476529786566-3').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Post', [[336, 280], [970, 90], [728, 90]], 'div-gpt-ad-1476529786566-4').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Post_Mobile', [[320, 50], [320, 100], [300, 250]], 'div-gpt-ad-1476529786566-5').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Side', [[300, 600], [160, 600], [300, 250]], 'div-gpt-ad-1476529786566-6').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Top', [[336, 280], [970, 90], [728, 90]], 'div-gpt-ad-1476529786566-7').addService(googletag.pubads()); googletag.defineSlot('/275425923/AdX_Top_Mobile', [[320, 50], [320, 100]], 'div-gpt-ad-1476529786566-8').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.pubads().collapseEmptyDivs(); googletag.pubads().enableSyncRendering(); googletag.enableServices(); }); </script>
Body code remains same, no matter if async or sync.
-
However, as @PitaJ suggested it can be done as well by a simple header code.
What code do you refer to? Do you mean this?
var _refreshTitle = app.refreshTitle; app.refreshTitle = function (title) { _refreshTitle(title); googletag.pubads().refresh(); };
- Can I do a "after first post ad placement." with widgets?
- Do your header + body code need additional mods to work? Extra headercode or modify of ajax file?
I will keep following this thred and when everything is solved maybe you can help me out with a working simple example I guess I need this working too Thanks!
EDIT: It seams that you site reload the whole site for every click i do. It it a temp fix?
-
@Jenkler yes the reloading you see on my site is temp as I do not want to violate AdSense ToS.
And the after first post ad cannot be done without any modification to the widgets.js. However, it is a relatively simple thing to do.
-
@AOKP the after first post ad should be able to be done by modifying your theme files.
-
@AOKP I'm looking at your forum, and it appears that your ads are inserted with widgets. I would recommend trying putting the ad elements into your theme files directly. You can make them partials and just include them in the main theme files for topics, main content, etc.
If you were trying to use DFP sync rendering inside widgets, it wouldn't work since I think widgets are loading asynchronously and inserted into the page. In fact, you should probably bake all of your DFP code into a custom theme.
-
@AOKP it could be that the widget HTML hasn't loaded in before it attempts to load the ads, so the ads fail to load.
Please try putting the DFP stuff directly in your theme.
-
@PitaJ not working either.
Again let me roll up things once again very clearly. Please also read it properly.
A long time ago DFP sync ads were working fine, just like an Anti-AdBlock script I used.
Same was for ad code provided from other advertisers, like Sulvo or Ezoic. However, since 6 months NodeBB started to cause real issues.
Sync ads broke the entire page, the Anti-AdBlocker stopped working and ads from other providers (using document.write) stopped too.And since version 1.2.x ads do not show up at all.
Except AdSense ones. I tried it on a blank install, I followed the setup guide step by step, but the issue still appears.
Even my AdX account manager says that the issue is on my end, just like the many other tech staff from other advertisers (thanks for their support). This sh*t cannot be fixed by inlining DFP code, nor can it be fixed by any other approach, which is not related to code hacking.Excuse the curse, but there is no other way to describe the issue properly.
@baris, are there any security concerns if I downgrade to NodeBB v0.9.x? Even though I said that downgrading is not an option for me and that it won't be any beneficial for NodeBB to leave it unfixed I think as of now this would be the best option.
-
You've been asked not to bump. Please don't continue doing it!
You know, it might be so simple that people don't know how to help you without putting a lot of effort into investigating this issue.
If you hire/pay the nodebb staff for a few hour they might be able to help you. -
@hek I only asked him not to bump it every day. He can bump with lower frequency of he wants.
-
@hek ironically I sent a request for that already and was told to wait until the end of October. However, before I will pay 300$ on a plugin which allows me to load custom JS I rather throw the money away for a DB conversion to IPB.
And as mentioned before. The issue is not only occuring with ads. It is related to ANY custom JS.
If you think that this is not worth to investigate I can't help it. Why you even read the topic then?I do think I speak for all the webmasters when I say that we need to load custom stuff. No matter if it is CSS or JS and that we also need to have a proper possibility to monetize our sites with either a working plugin or a different method.
Otherwise you can continue to host MC kiddies.
I really do like NodeBB, but also am happy at the same time that I didn't applied it to all of my sites.
And considering the fact that it wants to take a leadership in forum software by showing how functional it is, it also shows how "unprofessional" it is.
Don't understand this as hate. But just think of the following use case. You want to run an enterprise forum and have to choose between traditional forum software or NodeBB. NodeBB seems to have all the features you need, but unfortunately it is not capable to deal with some of your custom code. So what will you do? But keep in mind that the other forum software would be extendable to have the same features as NodeBB within a few simple steps.
-
@AOKP said in NodeBB and ads - A never ending story (Part 2):
before I will pay 300$ on a plugin
I wouldn't mind contributing to this endeavor. Think of it as a crowd funded development effort. Would the NodeBB team be willing to allow for multiple financial contributors to this plugin? At some point I will need to monetize my forum and first attempting through ads sounds reasonable.
-
@rod I wouldn't pay to get this issue fixed. But if the team makes us a 100% compatible DFP plugin I would take the bill. I am not crying about money as an issue here.
And a general note:
There were no words about the price yet. But this was a "just in case".Update:
Me and @rod hooked together and tried a few NodeBB versions. What we say for sure now is that NodeBB is facing issues since 0.9.x to render ads synchronously, which means that 0.8.x is the only working version of NodeBB with full ad support.I personally think it is related to the js.js file, however no guarantee upon that.