S
S
Sergey2021-06-28 09:23:48
React
Sergey, 2021-06-28 09:23:48

How to connect the YAN block to a Next JS project?

Yandex issues such a code for its advertising. How to properly attach it to next js? Okay, even react there, you can probably put index.html directly on the header, but next I don’t understand how to do something. Can anyone suggest

<!-- Yandex.RTB XXXXX -->
<div id="yandex_rtb_XXXXXX"></div>
<script type="text/javascript">
    (function(w, d, n, s, t) {
        w[n] = w[n] || [];
        w[n].push(function() {
            Ya.Context.AdvManager.render({
                blockId: "XXXXXX",
                renderTo: "yandex_rtb_XXXXXXX",
                horizontalAlign: false,
                async: true
            });
        });
        t = d.getElementsByTagName("script")[0];
        s = d.createElement("script");
        s.type = "text/javascript";
        s.src = "//an.yandex.ru/system/context.js";
        s.async = true;
        t.parentNode.insertBefore(s, t);
    })(this, this.document, "yandexContextAsyncCallbacks");
</script>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question