📜 ⬆️ ⬇️

Advertising: struggling with hangs when loading a page

Surely, many users are annoyed by the fact that there is a slow loading of advertising blocks of YAN and Yandex.Market, which makes it impossible to load the main content of the page before the block is fully loaded.
Such a problem suffers incl. and Habr - often, having entered the topic, comments are not displayed for quite a long time (and the browser shows something like “waiting for a response from bs.yandex.ru”).
However, if webmasters take care of users, this problem can be avoided by using the old new, albeit long-established way of placing ad units.

Quote from off. FAQ YAN :

“The partners of the Yandex Advertising Network have the opportunity to place the HTML code of the ad unit in the place of the page where it is convenient for the webmaster, and show it where it is convenient for visitors.
For example, you can define a place to display advertisements at the top of the page, and place the ad call code at the end of the page’s html code before the </ body> tag.
To take advantage of new features, you need to add the variable yandex_direct_place for Yandex.Direct and yandex_market_place for Market to the ad call code.

For the Yandex.Direct block, add the line to the ad call code:
yandex_direct_place = 'ya_direct';
where ya_direct is the tag id in the page code in which the ads should be displayed.
And in the place of the page where the ad unit should be displayed, place the code:
<div id = 'ya_direct'> </ div>
For the Market block, add the line to the ad call code:
yandex_market_place = 'ya_market'; "
')
Thus, by placing the ad unit code somewhere in front of the </ body> tag and making the call in the right place, we will display the advertisement and not make the user wait.
Respect users!

PS: If they do this on a habr - I will be happy =)

Source: https://habr.com/ru/post/74032/


All Articles