Code forwarding

Description

With code forwarding, you can install arbitrary HTML code in the banner container. If the code contains scripts, they will be executed in the context of the page.

You can use the following banner features in Adfox:

  • Both HTML5 code and asynchronous embed code from any ad management system can be installed.
  • You can place any HTML code that can go beyond the container: for example, showing Fullscreen, Background, or expandable banners.

Format features:

To place the Adfox ad tag with the context.js library, use the Adfox forwarding code [context] template.

Code requirements

  1. The maximum allowed number of characters in the HTML code is 65,000.

  2. It's best to place JavaScript and CSS inside the HTML code of the banner. If the final HTML code exceeds the maximum acceptable size, reduce it by splitting JavaScript and CSS code into separate files:

    1. Save the JS and CSS code in separate files with the .js or .css extension.

    2. File size can't exceed 10 MB.

    3. Upload the files to the ad campaign's Files tab and add the resulting file links to the HTML code:

      • If the project includes absolute links (src="js/script.js", src="css/style.css"), Adfox will recognize the paths to the files and automatically add them to the Files tab, replacing all links to these files in the project during the upload.

      • If the project includes relative links (src="../js/script.js"), use one of the following methods:

        • Replace .js and .css file links with absolute paths: Adfox parsing will trigger, and all links will be replaced automatically.
        • Manually upload .js and .css files to the Files tab and replace relative links in your HTML code with the ones you'll get from Adfox.

      Example of connecting JS and CSS files:

      <script type="text/javascript" src="LINK_TO_FILE"></script><link rel="stylesheet" type="text/css" href="LINK_TO_FILE" />
      
  3. You can install any HTML code, Adfox ad tag with the context.js library, or asynchronous ad tag of another ad system (without the document.write function).

Note

If the HTML code that you want to add to Adfox as a banner contains document.write, you can't use the Code forwarding [context] template. In that case, we recommend adding the code through the Banner HTML5 [context] template.

Requirements for counting clicks in a banner with HTML5 code

  1. Counting clicks on banners.

    To count click statistics for a banner in Adfox, you need to include the following variable in the а tag for the href attribute in the HTML code:

    %banner.reference_mrc_user25%

    For links, use the target attribute with the %banner.target% variable as an attribute. If the attribute is missing, the link will open inside the iframe: that is, the advertised site will open in the location of the banner.

    Example of HTML code that counts banner clicks:

    <a href="%banner.reference_mrc_user25%" target="%banner.target%">Advertiser's site</a>
    
  2. Counting clicks for multiple links on the banner. Let's say the banner has several links leading to different pages of the advertised site, and you need to count the number of clicks for each of them.

    <a href="http://site.ru" target="_blank">First link</a>
    <a href="http://site.ru/about/" target="_blank">Second link</a>
    

    Replace the href attribute value with the %request.reference_mrc%&pf=%banner.eventN:urlenc% variables, where N is the event number from 1 to 28.

    For example:

    <a href="%request.reference_mrc%&pf=%banner.event1:urlenc%" target="%banner.target%">First link</a>  
    <a href="%request.reference_mrc%&pf=%banner.event2:urlenc%" target="%banner.target%">Second link</a>
    

    You need to inform the manager who adds the banner to Adfox about which links correspond to which variables. When adding a banner, you'll need to specify the first link for Event 1, and the second link for Event 2 on the Events tab.

Add a banner

  1. To add a banner with a code, use the Code forwarding [context] template.

  2. If this template is missing from the banner type list, add it from the preset.

  3. When adding a banner, specify the parameters:

    Parameter

    Description

    Tracking pixel link

    By default, the Adfox //banners.adfox.ru/transparent.gif pixel is used. If you want to count impressions in a third-party system, delete the Adfox pixel and provide another link.

    HTML ad tag

    Insert the HTML code.

    Transition URL

    Specify the link to the advertiser's site, provided that the HTML code complies with the requirements for embedding code to count clicks.

    If the HTML code contains several links to different pages of the advertised site, leave the Transition URL field empty and specify the links on the Events tab after adding the banner.

    For the click-through to work correctly, make sure that the link includes the protocol (http:// or https://).

    Name of the banner container class attribute

    If necessary, enter a name (or multiple names separated by a space) for the class attribute of the banner container.

    Advertising label settings:

    • Ad label
    • Domain

    Note

    If the format of the banner is sticky, manually add the layout for the “Ad” label to your ad unit code. We don't recommend enabling the “Ad” label in the banner parameters in Adfox.

    In the Ad label list, select Ad or Social ad to label the banner. If your ad creative already contains a label, you can leave the Disabled value in the drop-down list.

    Note

    Adding the “Social ad” label doesn't automatically define the creative as social advertising. To label a creative as a social ad (PSA) in the state register, select Social advertising contract with payment or Social advertising contract by quota for the corresponding contract with the end advertiser.

    In the Domain field, specify the advertiser domain, and it will be added to the label: “Ad | example.com” or “Social ad | example.com” (only if the Ad or Social Ad value is selected in the dropdown list).

    Show banner menu

    To add a token to a non-clickable banner, enable the Show banner menu option in the banner settings. When the banner is served, the  menu icon will be displayed in its upper-right corner. When a user clicks the icon, the advertiser's details and the copy token button appear (if ad register is enabled for the banner or a third-party token is specified).

    The banner menu contains a link to the rules for using recommendation technologies. It's required for compliance with Clause 3 of Section 1 of Article 10.2-2 of the Federal Law No. 149-FZ “On information, information technologies, and information protection”, dated July 27, 2006.

    Note

    If the banner is non-clickable (the Transition URL field is empty) and has not been added to the ad register, you can enable the banner menu to make the token available when serving the banner.

    Advertising labeling

    Advertising labeling: This section is only available if you've selected Submit data to state register as a labeling procedure in the campaign settings. Fill in the fields in this section to register the creative in the Yandex advertising data operator. The creative is assigned a token automatically.

Add a default banner

  1. To add a default banner with any HTML code, use the code generator.
  2. Select the Third-party ad tag code type and paste the HTML code into the code input field.
  3. Add tracking pixels if necessary.
  4. Copy the ad tag and paste it in the Code field with the JavaScript type.

Example of placing third-party code:

Contact support

Send an email

The banner is fixed in the browser window and stays in the viewport as the user scrolls through the page.