Ads in Infinite Scroll
-
The Yandex Advertising Network documentation says the following:
To display ads in infinite scroll feeds, you can use the same ad unit and just change the?pageNumber?parameter and the name of the?renderTo?container. The unique?blockId?from the code designer remains unchanged.
Accordingly, I tried using the following two versions of code, which I inserted after every fifth paragraph (%5), but in the first case, the ad unit is shown only the first time, in the second case the last time.
<script type="text/javascript"> var randomNumber = Math.ceil(Math.random() * 100); document.write("<div id='yandex_rtb_",randomNumber,"'></div>"); window.yaContextCb.push(()=>{ Ya.Context.AdvManager.render({ blockId: "R-A-330561-155", renderTo: "yandex_rtb_"+randomNumber, pageNumber: randomNumber, }) }) </script>
———-
<div id="yandex_rtb"></div> <script type="text/javascript"> if (typeof pageNumber == "undefined") { var pageNumber = 1; } else { pageNumber++; } document.getElementById("yandex_rtb").id = "yandex_rtb_" + pageNumber; window.yaContextCb.push(()=>{ Ya.Context.AdvManager.render({ blockId: "R-A-330561-155", renderTo: "yandex_rtb_"+randomNumber, pageNumber: randomNumber, }) })</script>
Yandex said that the issue is not on their side. I checked: If I insert the code manually (without the plugin) their code does work.
Yandex advised me to contact the plugin developer for clarification.
- The topic ‘Ads in Infinite Scroll’ is closed to new replies.