Code forwarding

Description

With code forwarding, you can install any 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 ad tag 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 code forwarding [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 allowed size, reduce it by splitting JavaScript and CSS into separate files:

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

    2. File weight can't be more than 300 KB.

    3. Upload the files to the Files tab of the ad campaign and embed the resulting links to the files in the HTML code.

      • If absolute links (src="js/script.js", src="css/style.css") are included in the project, then when the project is uploaded, Adfox recognizes the file paths, automatically uploads them to the Files tab, and replaces all links to these files in the uploaded project.

      • If relative links (for example, src="../js/script.js") are included in the project, use one of the following methods:

        • Replace the links to the .js and .css files with absolute links: Adfox parsing will work and all of the links will be replaced automatically.
        • Manually upload the .js and .css files to the Files tab. Then get links to these files in Adfox and replace the relative links with them in the HTML code.

      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. Click counting in the banner.

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

    %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 from multiple links in 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 hrefattribute values 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. So, 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:

    • Tracking pixel link: Adfox pixel is used by default //banners.adfox.ru/transparent.gif. If you need to keep track of impressions in an external system, delete the Adfox pixel and specify another link.
    • HTML ad tag: Embed the HTML code.
    • Click URL: Specify the link to the advertiser's site, provided that the HTML code complies with the requirements for embedding code to process clicks.
  4. If the HTML code contains several links to different pages of the advertised site, leave the Click URL field empty and specify the links on the Events tab after adding the banner.

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

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

  7. Advertising label settings:

    Note

    If the banner has the sticky format, manually add the layout for the Ad" label to your unit code. We don't recommend including the Ad" label in the banner parameters in Adfox.

    • In the Ad label list, select Ad or Social ad, and the label will be added to the banner. If the creative's design already includes the label, you can keep Disabled" in the drop-down list.

      Note

      Adding the “Social ad” label doesn't automatically define the creative content as social ad. To label creative content as a social advertisement in the state register, select Social ads contract 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 you select Ad or Social ad in the drop-down list).

  8. 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 the upper right corner of it. When a user clicks this icon, the advertiser information and the copy token button appear (if ad register is enabled for the banner and a third-party token is specified).

    The banner menu contains a link to the rules for using recommendation technologies. That is necessary to comply with paragraph 3, section 1, article 10.2-2 of Federal Law No. 149-FZ On information, information technologies, and information protection", dated July 27, 2006.

    Note

    If a banner is non-clickable (the Transition URL field is not filled in) and it is to be added to the ad register, be sure to show the banner menu. This is the only way to make the token available when serving the banner.

  9. Settings for Russian ad register: The section is only available if the Submit data to state register procedure is selected 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 backup ad

  1. To add a backup ad 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 code and paste it in the Code box with the JavaScript type.

Example of placing third-party code:

Contact support

Send an email