Creating search blocks

Ad blocks for search results can be placed on site search platforms (for more information, read about creating and configuring platforms).

Search blocks that contain advertising related to a user's search context can be placed on site search platforms (for more information, read about creating and configuring platforms).

Restriction.

You are not allowed to place code for search ad blocks on content sites (that do not generate search results) and transmit search terms manually. This might cause the partner's account to be blocked.

To create ad blocks in the Yandex Advertising Network interface, use the visual code designer. The code designer lets you specify the desired ad format, select the appearance of your ad block, and configure it to match the design of your site.

To create a new premium placement or Yandex.Direct search block, go to the list of search blocks (Products → Premium placement or Products → Yandex.Direct Search). Click Add special placement block or Add Yandex.Direct search block.

  1. Select a platform from the list to place your block and specify the block name in the form that opens on the General tab.

  2. Specify the maximum number of ads on the Formats tab:

    • For premium placement block: 1–3;
    • For Yandex.Direct search block: 1–9 (if a block is placed under the search results, it should contain at least 4 ads).

    Here you can also disable showing sitelinks and advertiser site icons in this block.

  3. On the Yandex.Direct design tab, you can set the block's visual design: set the font type and color palette, and select the type of corners and border. All changes to settings are immediately displayed in the test block. The design of your ad block significantly influences the CTR and, consequently, your site revenue.

    Attention. In accordance with the Terms of Participation, the Yandex.Direct link and the advertisers' domains must be clearly visible and easily distinguishable.
  4. Click Create. Select a code execution type (synchronous/asynchronous) in the form that opens, copy your JavaScript code and insert it into the HTML code of the page where you want your ads to display.

    Tip. Please keep in mind that when copying code, your text editor might truncate or wrap long strings, which might cause the JavaScript code to run incorrectly. Make sure the code does not get modified during copying. The Copy to clipboard button is the best way to copy the code.

A unique ID will be assigned to the block after it is saved, and the block will be displayed in the list of Yandex.Direct blocks. A block ID (ID) consists of a product ID (P-A or D-A), platform ID (page_id) and the block's serial number.

Restriction. Note that you are not allowed to place a premium placement block alone (without a Yandex.Direct ad block).

To correctly transmit a use'sr search query to Yandex and obtain ads that match the search terms, specify the following variables in the block code:

  • search_text — The user's search query.

  • search_page_number — The page number in search results.

Specify a variable/function/script (depending on the search solution used) in the search_text variable value. Sending pre-set search queries is prohibited.

Code example for premium placement
<!-- Yandex.Premium P-A-12345-1 -->
<div id="yandex_direct_P-A-12345-1"></div>
<script type="text/javascript">
    (function(w, d, n, s, t) {
        w[n] = w[n] || [];
        w[n].push(function() {
            Ya.Context.AdvManager.render({
                blockId: "P-A-12345-1",
                renderTo: "yandex_direct_P-A-12345-1",
                searchText: "search query",
                searchPageNumber: 1
            });
        });
        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>
Code example for Yandex.Direct search block
<!-- Yandex.Direct D-A-12345-1 -->
<div id="yandex_direct_D-A-12345-1"></div>
<script type="text/javascript">
    (function(w, d, n, s, t) {
        w[n] = w[n] || [];
        w[n].push(function() {
            Ya.Context.AdvManager.render({
                blockId: "D-A-12345-1",
                renderTo: "yandex_direct_D-A-12345-1"
                searchText: "search query",
                searchPageNumber: 1
            });
        });
        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>

If you want to create another block with the same settings, click Duplicate. The new block will be displayed in the list of search blocks.

To edit added blocks, go to the list of search blocks (Products → Premium placement or Products → Yandex.Direct Search). Find the block you need and click Edit.