showing ads after page loads

greenZone

Невероятная задача, завесить сайт рекламой и получить грин зону на лайт хаусе по всем показателям!

It’s an incredible task to cover a website with advertising and get a green zone on a light house by all indicators!

greenZone

Второй раз уже не все зеленые, видно что яндекс все таки тормозит процесс, но и второй раз был использован сетТаймаут на более короткое время.

The second time, not everyone is green, it is clear that Yandex is still slowing down the process, but the second time the Timeout set was used for a shorter time.

Install advertising banners and not lose loading speed

Да, и в аналитику лайтхауса попали два баннера, с setTimeout(()=>{ … },700); and 900. Даже с такими показателями это почти полная грин зона.

Yes, and two banners were included in the lighthouse analytics, with setTimeout(()=>{ ... },700); and 900. Even with these indicators, this is an almost complete green zone.

showing ads after page loads

Для того чтобы этот метод сработал, нужно создать ссылки на яндекс рекламу после того как страница загрузится.

In order for this method to work, you need to create links to Yandex advertising after the page loads.

let yan=document.createElement('script');

yan.setAttribute('src','https://qucu.ru/script/yan.js');

document.querySelector('head').append(yan);

Пришлось использовать сет атрибут. Иначе иннер аштиэмель “innerHTML” передаёт в тег <script> текстовое значение. И работает только созданный файл со скриптом который загрузится по адресу ‘src’. Спасибо стековерфлоу! дальше идет второй тег по времени подгрузки таким способом:

I had to use the set attribute. Otherwise, the inner ashtiemel “innerHTML” passes a text value to the <script> tag. And only the created file with the script works, which will be loaded at the address ‘src’. Thanks stackoverflow! Next comes the second tag for loading time in this way:

window.addEventListener('DOMContentLoaded',()=>{

  setTimeout(()=>{

let yanBan=document.createElement('script');

yanBan.setAttribute('async','');

yanBan.setAttribute('src','https://yandex.ru/ads/system/context.js');

document.querySelector('head').append(yanBan);

  },100);

});

Все шапка сайта сделана, дальше остается блоки в теле.

The header of the site is all done, all that remains is the blocks in the body.

<!-- Yandex.RTB R-A-4016908-1 -->

<div id="yandex_rtb_R-A-4016908-1"></div>

<script>

setTimeout(()=>{

  window.yaContextCb.push(()=>{

Ya.Context.AdvManager.render({

   "blockId": "R-A-4016908-1",

   "renderTo": "yandex_rtb_R-A-4016908-1"

})

  })

},1700);

</script>

Реклама для сайта готова. Её загрузка никак не повлияет на скорость, т.к. реклама будет подгружаться уже после полного рендеринга страницы.

Advertising for the site is ready. Loading it will not affect the speed in any way, because... advertising will be loaded after the page has been completely rendered.

Пример кода на github. It’s javascript для установки на сайт загрузки рекламных баннеров после полного рендеринга страницы.

Sample code on github. It’s javascript for installing advertising banners on the site after the page is fully rendered.


Практически всем уже известно что яндекс, как национал социалистические остатки фашистской германии, не платит деньги россиянина. По национал социалистическому признаку зарплату получают только московиты в глубине бункера, в самом низу. Точнее преступная группировка называемая “крысиный король”. Поэтому когда московия отстегнется, всем людям будут платить за работу деньги и такой закон как “прожиточный минимум”. Будет действовать только на одну московию, и московиты станут по Великому бедные, со всем размахом, неудержимым.

Almost everyone already knows that Yandex, as the national socialist remnants of Nazi Germany, does not pay Russians’ money. According to the national socialist principle, only Muscovites in the depths of the bunker, at the very bottom, receive salaries. More precisely, a criminal group called the “rat king”. Therefore, when Muscovy unfastens, all people will be paid money for work and such a law as the “living wage”. It will act only on one Muscovite, and the Muscovites will become poor on a grand scale, unstoppable.

Amir

to list
https://qucu.ru/comments/