scott001 Posted August 30, 2018 Report Share Posted August 30, 2018 I use async tags like below to several ads per page. <!-- Advertising Asynchronous JS Tag - Generated with Revive Adserver v4.1.4 --> <ins data-revive-zoneid="325" data-revive-id="1231231236728d3123911a0123"></ins> <script async src="//www.mysite.com/adserv/www/delivery/asyncjs.php"></script> It works fine, however, on site speed tests I am now seeing warning like this: The following scripts are parsed and executed several times on your page: //www.wheat-free.com/adserv/www/delivery/asyncjs.php (parsed and executed 11 times) 1) I am aware of the single page call tag that I've used in the past to serve ads, but is it possible to use the single page call with the async tags? 2) A proposed solution that is used widely, is below, but I am not sure how to make this work for my site..any help would be appreciated. I'm not even sure, once this is written properly for my situation, where the script would go...the header? Here is their example for Facebook--I have bolded area that probably need to to be changed, but again, I am not sure: (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); So to make this work for my ad script: //www.mysite.com/adserv/www/delivery/asyncjs.php it might look something like this: (function(d, s, id){ var js, mjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//www.mysite.com/adserv/www/delivery/asyncjs.php"; mjs.parentNode.insertBefore(js, mjs); }(document, 'script', 'mysite-jssdk')); Quote Link to comment Share on other sites More sharing options...
scott001 Posted September 6, 2018 Author Report Share Posted September 6, 2018 Any help would be appreciated....I am surprised that this isn't an issue for more users. Quote Link to comment Share on other sites More sharing options...
Rennew Posted September 14, 2018 Report Share Posted September 14, 2018 In my webiste i call the scirpt in the head section. <script async src="//www.mysite.com/adserv/www/delivery/asyncjs.php"></script> After that i only insert the <ins data-revive-zoneid="325" data-revive-id="1231231236728d3123911a0123"></ins> section for every banner load. Maybe is good four you. Quote Link to comment Share on other sites More sharing options...
andrewatfornax Posted September 18, 2018 Report Share Posted September 18, 2018 Yes, there's no reason why you cannot use both Single Page call and Async JavaScript tags on the same page, if you want to - but that won't give you a single call style Aysnc JS tags, just two different sorts of tags. You can go down the path of trying to combine them all if you want, but I don't think it really matters that the same script is called multiple time - it's okay that it does this, really. Where are you seeing the warnings? Quote Link to comment Share on other sites More sharing options...
scott001 Posted September 20, 2018 Author Report Share Posted September 20, 2018 (edited) Here is what I've done, and I hope my banner stats will still be correct. I removed this tag throughout my entire site in my async ad code. This code appeared with each banner call, and in my case this meant 7 or more times per page load: <script async src="/adserv/www/delivery/asyncjs.php"></script> at the bottom of my site's global template, just before the closing </body> tag, I added this, and notice the "defer" in it: <script async src="/adserv/www/delivery/asyncjs.php" defer></script> I am testing it now, and hope the stats, click tracking, etc. will work. I will report my findings here. Doing this has done several things for my site speed, for example these scripts were causing a render blocking javascript issue on google's page speed tests, which has gone away now. Since the script is only loaded once, it speeds up the loading of each page. Edited September 20, 2018 by scott001 Quote Link to comment Share on other sites More sharing options...
scott001 Posted September 22, 2018 Author Report Share Posted September 22, 2018 This works fine, and perhaps should be the way the code is implemented? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.