inherit
211778
0
Aug 3, 2016 11:36:21 GMT -8
ponzinomics
250
July 2014
ponzinomics
|
Post by ponzinomics on Aug 4, 2014 12:33:54 GMT -8
Hi, I tried to place some adverts in my forum (which is ad-free) and I am having problems with the script. When I navigate back and forward the pages of a thread I get a blank screen with just the adverts and an error:
I insert a code like the one below:
<script type="text/javascript"> ( function() { // blah blah }()); </script> <script type="text/javascript" src="blah blah" async></script> in PostList template, and after navigating back and forward, I get a blank screen with this js error:
An error occurred during a document.ready call: TypeError: Cannot read property 'data' of undefined
While executing: function () {
shorty_thread_descriptions.init();
}
Uncaught SyntaxError: Unexpected token ILLEGAL pbid.pro-market.net/engine?site=131222;size=1x1;e=0;category=qwerzn7ur4r;kw=up5%20rbxvxehct%205p6eaqv6mt%20-%20h5niqwglid0%20g8g;rnd=(1407117179278):7
9
Uncaught TypeError: Cannot read property 'postMessage' of null cdn.chitika.net/getads.js:399
12677 : CS -> BG : FAILED closepopuptoplevel
118221 : CS -> BG : FAILED closepopuptoplevel onloadwff.js:77
Uncaught TypeError: Cannot read property 'postMessage' of null cdn.chitika.net/getads.js:399
12677 : CS -> BG : FAILED
closepopuptoplevel
118221 : CS -> BG : FAILED closepopuptoplevel onloadwff.js:77
215065 : CS -> BG : FAILED closepopuptoplevel onloadwff.js:77
1136181 : CS -> BG : FAILED closepopuptoplevel onloadwff.js:77
1138668 : CS -> BG : FAILED closepopuptoplevel onloadwff.js:77
1149712 : CS -> BG : FAILED closepopuptoplevel onloadwff.js:77 I tried another ad network and I had similar problem so I guess proboards generated page is the source of the issue.
* Any idea about the error? * Is there any subforum to discuss monetizing and choices of ad networks for beginners? My current intend is just a proof of concept but I tried 3 or 4 ad networks and I found errors, troubles and lot of time wasted.
Thanks
|
|
#eb7100
33409
0
1
May 19, 2024 9:29:00 GMT -8
Brian
48,129
November 2004
smashmaster3
|
Post by Brian on Aug 4, 2014 12:41:34 GMT -8
Hi, ponzinomics. What's the link to your forum? I'm sure this has to do with the fact that the page has to constantly loop through the Post List template and therefore renders your ad over and over again but it's much easier to diagnose seeing it firsthand.
|
|
inherit
211778
0
Aug 3, 2016 11:36:21 GMT -8
ponzinomics
250
July 2014
ponzinomics
|
Post by ponzinomics on Aug 4, 2014 12:48:24 GMT -8
Hi Brian, I have temporarily enabled the ads so you can see the error. A sample link that I tested is this one ponzinomics.org/thread/227/abenomics-experimentby navigating page1-> page2-> page1 = crash You can see the script code by looking for "advert inter posts" String in the source It is really beyond my knowledge because I do not know neither Proboards details nor ad network details to investigate so do not know how to proceed. What I know is that it failed with 2 networks so this makes me think in a proboards issue. The loop that you comment makes sense.
|
|
#eb7100
33409
0
1
May 19, 2024 9:29:00 GMT -8
Brian
48,129
November 2004
smashmaster3
|
Post by Brian on Aug 4, 2014 13:31:00 GMT -8
You can always create a new theme on your forum and test the code on that theme if you don't want it to affect your forum's regular theme. I think the problem is the document.write line in the code. That doesn't play well with the page switcher for some reason. Unfortunately I wouldn't be able to offer you a solution on how to fix that other than to move the ads somewhere other than the Post List template as they're not going to work there if reliant on that code.
|
|
inherit
211778
0
Aug 3, 2016 11:36:21 GMT -8
ponzinomics
250
July 2014
ponzinomics
|
Post by ponzinomics on Aug 4, 2014 13:44:14 GMT -8
Document.write makes sense, yes. 2 questions then:
* are this kind of issues fixed for next versions of the software and, if so, what are the possible upgrade paths in underlying framework for a forum supposed to be already running (including e.g. forums.net, etc...),
* and, ok, taking out the ad networks using a document.write, is there any known experience/thread/board on some specific ad networks for beginners playing well with the proboards' PostList? As commented, just looking for a proof of concept right now.
Thanks
|
|
#eb7100
33409
0
1
May 19, 2024 9:29:00 GMT -8
Brian
48,129
November 2004
smashmaster3
|
Post by Brian on Aug 4, 2014 14:01:26 GMT -8
It's typically considered bad practice to use document.write in modern Javascript, so I don't believe we have any intentions to make it work in that particular area when there's several other methods that aren't universally shunned upon to achieve pretty much the same thing outside of the Post List template. The main problem is that it's editing the DOM in a way the list manager can't interpret properly because it's executed the moment it's loaded while the rest of the post list is still rendering on the page after switching the page.
As long as your ad code doesn't use a document.write line within the Post List template it should be fine.
If you can tell me exactly how your ads are meant to display I can attempt a workaround.
|
|
inherit
211778
0
Aug 3, 2016 11:36:21 GMT -8
ponzinomics
250
July 2014
ponzinomics
|
Post by ponzinomics on Aug 4, 2014 14:08:33 GMT -8
Hi Brian, I intent to add an 300*250 ad in the first and last posts and a thin-large ad banner, e.g. 725*80 (as a ref) in odd posts. Just for testing and putting the code in place. But I agree that document.write is not an nice technique. Do not worry, do not try the workaround as it probably will head us on several more fixes adapting to a bad practice. I will drop them an email just for their knowledge that document.write leads to issues and I will try some other ad network without document.write and will update this thread. Thanks for the support Update: stackoverflow.com/questions/2559189/what-damage-is-done-by-document-writeUpdate2: edomz, chitika both use document.write
|
|
#eb7100
33409
0
1
May 19, 2024 9:29:00 GMT -8
Brian
48,129
November 2004
smashmaster3
|
Post by Brian on Aug 4, 2014 15:01:42 GMT -8
Here's what I've come up with so far. The ads aren't actually showing on my test forum likely due to the fact that they're targeted at yours but the code itself is working. I placed this at the bottom of Themes > Layout Templates > Thread. ads1.txt (1.24 KB) And this is my layout in Themes > Layout Templates > Thread > Post List. ads2.txt (2.34 KB)
|
|
inherit
211778
0
Aug 3, 2016 11:36:21 GMT -8
ponzinomics
250
July 2014
ponzinomics
|
Post by ponzinomics on Aug 4, 2014 15:17:38 GMT -8
Hello Brian, added. Mixed results but happily no errors. In Chrome and Firefox, both ads work in the page 1 but no longer come up after navigating pages (sometimes the inter-posts comes up) In IE, works the page 1 and when navigating only the inter-posts ad comes up Despite it is a bad practice, it looks ad networks use it quite extensively.
|
|
#eb7100
33409
0
1
May 19, 2024 9:29:00 GMT -8
Brian
48,129
November 2004
smashmaster3
|
Post by Brian on Aug 4, 2014 15:32:45 GMT -8
The main problem is that most ad providers designed those advertisements with static pages in mind. Basically, you'd stick them in one area on the top or the bottom of the page and they'd stay there.
The post list on our forums isn't a static page. It's a dynamic table that uses AJAX requests to change its contents when you attempt to change pages in the thread and therefore requires a different process to append things to it as it's not actually navigating to a different page on the site. It's only changing the table contents on the same page over and over again.
You could try adding this to the bottom of the Thread template to force the page to reload when switching pages.
I suggest removing this first though:
|
|
inherit
211778
0
Aug 3, 2016 11:36:21 GMT -8
ponzinomics
250
July 2014
ponzinomics
|
Post by ponzinomics on Aug 4, 2014 15:46:43 GMT -8
I did both changes and looks pretty much the same results. Now they are enabled on the site if you want to test as it is not breaking. Well, depends if you start on page 1 or page 2, you see one ad or the other, both or none.
I agree with the static pages idea. Actually, sometimes they ask you for the exact page where the ad will be placed and in a forum, this is, unknown. Ad networks are below state of arts.
Well, I am not really in a hurry. Take your time to discuss with somebody if you needed. Currently they are not breaking the site so I can leave current configuration.
|
|
#eb7100
33409
0
1
May 19, 2024 9:29:00 GMT -8
Brian
48,129
November 2004
smashmaster3
|
Post by Brian on Aug 4, 2014 15:56:56 GMT -8
The first post ad will only work on page 1 because you originally had it coded that way. All you should have to do to is go to the Post List template and find this section, then remove the bits in red.
|
|
inherit
211778
0
Aug 3, 2016 11:36:21 GMT -8
ponzinomics
250
July 2014
ponzinomics
|
Post by ponzinomics on Aug 4, 2014 16:15:43 GMT -8
I agree with that. Removed the constraint, and also removed previous comments (so they do not confuse), but surprisingly, I see the same. By removing the constraint I would expect ads within all posts It looks to be adding just 1 intrapost ad, no matter if you start in page 1 or 2, it just will show 1 intrapost ad on the first post rendered
|
|
#eb7100
33409
0
1
May 19, 2024 9:29:00 GMT -8
Brian
48,129
November 2004
smashmaster3
|
Post by Brian on Aug 5, 2014 8:03:12 GMT -8
I changed the code a bit. Can you try switching pages in your threads now and seeing what happens?
I'm getting one ad in the first post and multiple ads between posts.
|
|
inherit
211778
0
Aug 3, 2016 11:36:21 GMT -8
ponzinomics
250
July 2014
ponzinomics
|
Post by ponzinomics on Aug 5, 2014 11:33:56 GMT -8
ups, sorry the delay in replying. I do not properly understand. I think you managed to change the code in my templates (right?) and just need to test if it works now.
What I see is that now is working. The only think I do not understand is why there is only the intra-post message on the first post of each page and not 1 in each post. This is the expected behavior but I do not see what code is doing it.
But the issue seems almost fixed (if not already fixed).
|
|