HTML App Mobile Banner
The HTML5 App Mobile Banner displays HTML creatives in mobile apps.
You can use certain editing software to make HTML creatives. See instructions for Adobe Animate CC and Google Web Designer.
Project example in Adobe Animate CC.
Project example in Google Web Designer.
Develop an HTML creative
Make sure your HTML code meets the following requirements.
- The maximum size of an HTML file is 65,000 bytes.
- 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:
- The project can contain only one file with the .html extension.
- The maximum number of files in a single project is 50.
- File types allowed in the project: CSS, JS, HTML, GIF, PNG, JPG, JPEG, SVG, JSON, FLV, MP4, OGV, OGG, WEBM, AVI, and SWF.
The maximum size of each file (this applies to archived files as well):
- 300 KB.
- 1 MB for video files.
- File names must only contain numbers or Latin letters and an underscore character. You can't use spaces, quotation marks, and special characters in the file name.
- The completed project is a ZIP archive.
- Image requirements
- Maximum file size: 300 KB.
- Allowable image formats: PNG, GIF, JPG, SVG.
- Make sure to use high-resolution images: this will improve the banner's display quality on mobile devices. However, this might also make it take longer to load.
- To reduce image size, you can use services such as TinyPng, which supports PNG and JPEG files.
- You can use images in SVG format: they have a small file size, support animations, and are vector-based, which means they look better on any device, whether it's a desktop or a mobile.
Select the editing software for your HTML creative. Make sure to put your HTML creative into an archive according to the following instructions:
- Download a banner template with a single clickable area (a button).
- Create an HTML5 Canvas project in Adobe Animate (or open an existing one).
- Open the publication settings inand use the template from step 1.
- Select the desired directory and publish the project.
- The entire banner area is clickable: it's a button that leads to the advertiser's website. The link is pulled into the creative from the banner settings in Adfox.
Download a banner template for Google Web Designer.
You can use this banner's code when making creatives in the editor. Put the contents of the archive into the folder with the program templates, for example:
/Users/[USER_NAME]/Documents/Google Web Designer/templates
The template contains an
adfox_HTML5.jsscript and a set of parameters for click-throughs and event counters to work correctly:
%request.reference_mrc%, %user2%, %eventN%, where N is the event number from 4 to 30.
All events are assigned to animation elements on the Events tab.
The Interactive area component is used for calling actions.
Add it and select theevent.
On the Custom code tab, select the click call function:
callClick(): If a single button is used.
callClick(n): Used if there are multiple clickable buttons.
callEvent(n): Used for when you need to call an event from an animation without clicking.
nis the number of the event to be called.
How to use a stretching banner.
To make the banner stretch across the width of the container on the site, specify percentages instead of pixels for the banner location and dimensions on the Properties panel.
Use the Align by container and Adaptive layout options on the top toolbar.
If you enable Adaptive layout before using any alignment tools, when you change the parent container size, all elements are aligned relative to each other and relative to the container size.
You can use the relative element sizes in percentages and absolute sizes in pixels at the same time.
Project example in Google Web Designer.
Publish the project with the following settings:
Note. When adding a banner to Adfox, make sure to tell the manager which buttons match which events. For each event, the manager adds a unique link, which is then passed to the banner code as a variable.
- Collect files is enabled.
- Create ZIP archive is enabled.
- Groups unpacking is enabled.
- CSS prefix is enabled for WebKit and Mozilla.
After publishing the project, archive it with the .zip extension. Your creative is ready to be uploaded to the Adfox banner.
- Counting clicks in banners
If you want your Adfox banner to display click statistics, find the
atag for the
hrefattribute in your HTML code and add the following variable:
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 website will open in the location of the banner.
Example of HTML code that counts banner clicks:
<a href="%banner.reference_mrc_user2%" target="%banner.target%">Advertiser's website</a>
- Counting clicks for 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.com" target="_blank">First link</a> <a href="http://site.com/about/" target="_blank">Second link</a>
hrefattribute values with the
%request.reference_mrc@%banner.eventN%variables, where N is the event number from 4 to 28.
<a href="%request.reference_mrc%@%banner.event4%" target="%banner.target%">First link</a> <a href="%request.reference_mrc%@%banner.event5%" target="%banner.target%">Second link</a>
Make sure to inform the manager handling Adfox banner integration which links match which variables. When adding a banner via the Events tab, specify the following information:
http://site.com — %banner.event4%for Event 4.
http://site.com/about/ — %banner.event5%for Event 5.
Add a banner to Adfox
To add a banner to Adfox, select the App Mobile banner type you need and the HTML App Mobile Banner template.
- Archive with HTML5 creative: Upload a ZIP archive with the project. Leave the Creative HTML5 code box empty (it's filled with the contents of your project's HTML file after you add the banner).
- Creative HTML5 code: Upload a ZIP archive with the project prepared in HTML editors or paste the HTML code.
- Transition URL: Enter the link to the advertiser's website. For the click-through to work correctly, make sure that the link includes the protocol (
- Tracking pixel link: By default, the Adfox
//banners.adfox.com/transparent.gifpixel is used. If you want to count impressions in a third-party system, delete the Adfox pixel and provide another link.
- Under Advertising label settings:
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).Important. 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.