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.
- Click statistics can only be taken into account when placing HTML5 banner code considering the requirements.
- When placing a banner with an ad tag, click statistics aren't taken into account.
To place the Adfox ad tag with the context.js library, use the Adfox code forwarding [context] template.
- The maximum allowed number of characters in the HTML code is 65,000.
- Save the JS and CSS code in separate files with the .js or .css extension.
- File weight can't be more than 300 KB.
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="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
.cssfiles with absolute links: Adfox parsing will work and all of the links will be replaced automatically.
- Manually upload the
.cssfiles 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:
- 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).
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
- Click counting in the banner.
To count click statistics for the banner in Adfox, you need to include the following variable in the
atag for the
For links, use the
targetattribute 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>
- 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>
hrefattribute values with the
%request.reference_mrc%@%banner.eventN%variables, where N is the event number from 1 to 28.For example:
<a href="%request.reference_mrc%@%banner.event1%" target="%banner.target%">First link</a> <a href="%request.reference_mrc%@%banner.event2%" 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
Add a backup ad
Example of placing third-party code: