Get the ad tag

Ad tags from the site level

You should obtain the site-level ad tag for the ad placement once and install it on all the pages of your site.

When using tags from the site level, the Adfox interface creates a logical structure of your site. It contains site sections and placement names in each section. Sections have page templates that describe the range of URLs included in that section.

Use the Adfox interface to check what section of the site in Adfox a particular page will belong to.

To get the ad tag, open Inventory in the main menu and click Ad tag next to the site name.

Specify the ad tag parameters:

  • Banner type: Must match the banner type specified for the placement for which you're obtaining the ad tag.

  • Position: Must match the position of the placement for which you're obtaining the ad tag.

  • Parameter separator: Select the parameter separator to be used in the ad tag.

  • Code type: Determines how the ad tag works on the page:

    • Asynchronous code: Performs asynchronous banner ad responses.
    • Adaptive: Suitable for sites with an adaptive layout.
  • Number of ad tags (optional): Specify the number of ad placements on the site page where selected banners should be displayed. A different containerId is generated for each copy of the ad tag to allow serving ads within each placement.

    Installing copies of the same ad tag within a placement may result in duplicate banners appearing on the same page load. To avoid duplicates, use unrepeatable banners and campaigns.

  • Add InPage parameters (only for nondimensional banner types): Click it to set the parameters of an InPage video.

    List of parameters
    • The element after which the player must be shown (by default, undefined): A CSS selector that is applied globally (document.querySelectorAll), a calculated list of elements after which the InPage block can be embedded (for example, #article p).
    • Position of the element in the list (by default, 0): The element position in the list after which the InPage block should be embedded. You can set it as a percentage (of the number of selected elements) or in absolute numbers. For example: 50% or 5. If the absolute number is greater than the length of the list of elements, the block will be inserted as the last element.

    The following settings only apply to direct sale campaigns. The Yandex Advertising Network (YAN) advertising parameters are set up in the YAN partner interface. Learn more about enabling YAN monetization.

    • Does the banner stick (the option is disabled by default): Setting up banner sticking as the page is scrolled.

    • Banner sticking area (by default, auto): Selecting the banner's sticking area:

      • top: When the page is scrolled up, the banner is fixed at the top of the screen. When the page is scrolled down, the banner returns to its original position.
      • bottom: When the page is scrolled down, the banner is fixed at the bottom of the screen. When the page is scrolled up, the banner returns to its original position.
      • bottom-right: When the page is scrolled down, the banner is fixed in the lower-right part of the screen in a separate window. When the page is scrolled up, the banner returns to its original position.
      • bottom-left: When the page is scrolled down, the banner is fixed in the lower-left part of the screen in a separate window. When the page is scrolled up, the banner returns to its original position.
      • top-right: When the page is scrolled up, the banner is fixed in the upper-right part of the screen in a separate window. When the page is scrolled down, the banner returns to its original position.
      • top-left: When the page is scrolled up, the banner is fixed in the upper-left part of the screen in a separate window. When the page is scrolled down, the banner returns to its original position.
      • auto: When the page is scrolled down, the banner is fixed at the bottom of the screen. When the page is scrolled up, the banner is fixed at the top of the screen.
    • Color scheme of the expanded banner (by default, light): Setting the background of the banner's sticking area. Available for the bottom, top, and auto banner sticking methods:

      • light: Light background.
      • dark: Dark background.
    • Video replay: If you want a video to be replayed, manually add the replayMode parameter to the ad tag and set it to auto (automatic video replay) or manual (the player will show a screen with the Replay button).

Note

You can change the values of the id attribute for div and containerId, but they should be the same. They're needed to identify the ad container and ad request, though they don't affect the request itself. Other parameters (owner_id and params) are constant and can't be changed.

Ad tags from the placement level

The ad tag from the placement level belongs to a specific section of the site. You set the logical structure of your site in the interface (sections and placements). Then, you take the tags from the placement level in each site section and manually install them in the appropriate placement in your real site sections.

Make sure to embed this tag in the exact site section where you plan to serve ads.

If the site structure or the logic of selling ad placements on the site does not provide for site sectioning, you can use any of the suggested options.

Open the Inventory tab in the main menu. Select a site and go to SectionsPlacements. To get the ad tag, click Ad tag next to the placement.

In the window that opens, specify the ad tag parameters.

  • Code type: Determines how the ad tag works on the page:

    • Asynchronous code: Performs asynchronous banner ad responses.
    • Adaptive: Suitable for sites with an adaptive layout.
  • Number of ad tags (optional): Specify the number of ad placements on the site page where selected banners should be displayed. A different containerId is generated for each copy of the ad tag to allow serving ads within each placement.

    Installing copies of the same ad tag within a placement may result in duplicate banners appearing on the same page load. To avoid duplicates, use unrepeatable banners and campaigns.

    Learn more about ad tag types.

  • Add InPage parameters (only for nondimensional banner types): Click it to set the parameters of an InPage video. The list of parameters is given in the description of the ad tag from the site level.

Note

You can change the values of the id attribute for div and containerId, but they should be the same. They're needed to identify the ad container and ad request, though they don't affect the request itself. Other parameters (owner_id and params) are constant and cannot be changed.

Parameters that can be set up in the interface (previously, the settings were made in the ad tag parameters):

  • Code type (regular, session on page, unrepeatable banners or campaigns).

  • Impression limits at the placement level.

Special considerations for working with ad tags at this level:

  • You can only use an ad tag to serve the banner for which that specific ad tag was obtained for.

  • Other banners placed on the same placement can't be selected for serving with this tag.

  • If the banner that you received the tag from can't be served (for example, the banner isn't active), a placeholder is sent in response.

  • You can place the banner in multiple placements, but statistics are only collected for the placement that you received the ad tag from.

  • Allowed page URLs that you specified in the section parameters aren't checked at the time of the request.

  • From the banner placement level, you can also get a link to the pixel and click for measuring statistics.

To get the ad tag, open Campaigns in the main menu. Select the parameters for setup in the interface (previously, they appeared within the ad tag settings), pick a campaign, and go to BannersPlacement. Next to the placement, click Ad tag. In the window that opens, specify the ad tag parameters.

  • Open the link (only for standard banner types): Select where the browser will open the link to the advertiser's site (in a new browser window or in the current one).

  • Parameter separator: Select the parameter separator to be used in the ad tag.

  • Code type: Determines how the ad tag works on the page:

    • Asynchronous code: Performs asynchronous banner ad responses.
    • Adaptive: Suitable for sites with an adaptive layout.

    Learn more about ad tag types.

  • Add InPage parameters (only for nondimensional banner types): Click it to set the parameters of an InPage video. The list of parameters is given in the description of the ad tag from the site level.

Note

You can change the values of the id attribute for div and containerId, but they should be the same. They're needed to identify the ad container and ad request, though they don't affect the request itself. Other parameters (owner_id and params) are constant and cannot be changed.

Container requirements for the ad tag

For the ad to be called correctly, the container must meet the following conditions:

  • The container or its parent elements can't have the display:none style. Otherwise, the context.js library can't determine its size.

  • You can measure the container and parent element size.

    Note: if the parent element has a size set, but there are several nested elements without a size inside it, the container size is defined as 0 × 0. In this case, set the container size using the width or height(max-height) attributes and ensure that all nested elements have their size specified.

Container size check
  1. Before sending an ad request, the context.js library analyzes the size of the container with the ad tag. The request is sent only if the container size can be measured.

  2. If the container couldn't be measured, the context.js library sends the CONTAINER_IS_HIDDEN error to the browser console and waits for:

    • DOM (Document Object Model) to be completed.
    • Styles with sizes to be applied to the container.

    After that, a request is sent to the ad server.

Contact support

Send an email