Note
Note: To learn more about this format, preview a demo, or to see build guides for other authoring tools, see About deluxe banner.
When creating a deluxe banner in a code editor, it is recommended that you start with our official template bundle.
Files within the bundle:
README.txt
Amz_DeluxeBanner_1_0_1.zip
Amz_DeluxeBanner_1_0_1_DCO.zip
Amz_DeluxeBanner_1_0_1_Video.zip
Amz_DeluxeBanner_1_0_1_Video_DCO.zip
When you download the workspace, extract the file and make sure to preserve the structure of the directory.
deluxe banner functionality is programmed in the template files. At a minimum, the only changes you will need to make are to the loaded images and video assets, and their respective styles.
Note
Note: When updating or replacing images or videos, make sure to also update references to their file names and dimensions found in the index.html
, style.css
, and script.js
files.
The following table describes the list of files that are included in the downloadable template.
File Name |
Description |
Required |
---|---|---|
|
Temporary video that you should replace with your own video. |
Required |
|
Poster image displayed in the video location in the banner before the video starts and after the video ends. |
Optional |
You can test your banner by opening the index.html
files in your current modern browser. By changing the size of the browser window, you can get a sense of how the design will look at different sizes. However, this is not a reliable representation of how the ad will behave on a publisher's page. This will depend on the layout of the publisher's page and the custom variable settings.
After you finish creating your ad, proceed to setting up your ad in AAS. For more information, see Set up a deluxe banner.
If you are planning to upload multiple ads, make sure that the Ad Creation Wizard in AAS recognizes your workspace as a deluxe banner. Verify that the config.js
file contains the following JavaScript:
define({ "adFormatId": 10366 });
For more information about uploading ads in bulk, see Set up multiple ads using Ad Creation Wizard.
If you are developing ads with third-party libraries, we recommend that you call these libraries from a CDN (Content Delivery Network) when possible. This will help improve loading time and caching.
If you need to add Dynamic Creative Optimization (DCO) elements to your creative, see Add dynamic elements to your HTML ads using a code editor.
The following sections describe common methods to use to customize your deluxe banner.
A responsive banner resizes to fill whatever space is available on the screen. To create a responsive banner, set mdResizeBehavior
to responsive. To ensure that your design never displays in an unsupported size, set minimum and maximum heights and widths.
An adaptive banner snaps to different preset sizes based on the available space. Set mdResizeBehavior
to adaptive to make an adaptive banner. The ad will use the largest size that was set in the mdAdaptiveBreakpoints
variable to attempt to resize itself to fit in the designated area.
The following describes the ways in which you can use the mdAdaptiveBreakpoints
variable to the select the adaptive sizes:
-
If you want the ad to snap to predefined width values, for example, 300, 600, 900, 1200, set only the width breakpoints, and use the minimum height custom variable for the height. When the space that is available is greater than or equal to a breakpoint width, the ad will show that breakpoint width size.
-
Set specific width and height values for each breakpoint, for example, 300 x 250, 600 x 400, 900 x 750,1200 x 800. When the width available is greater than or equal to a breakpoint width, the ad will change to the width and height size set for that breakpoint.
If the space that is available is less than the smallest defined breakpoint width, the ad will use the values in the mdMinimumWidth
and mdMinimumHeight
custom variables as its size.
Perform the following procedure if you want the banner to display at a specific height and width.
Use the width and height dependency custom variables when you want the banner to resize itself based on different options.
mdWidthDependency
and mdHeightDependency
are custom variables that you can use to determine the basis for the ad's resizing. Possible values include the following:
-
advertiserDiv: Ad changes width or height according to the current width of the element that contains the ad.
-
browser: Ad resizes according to the width of the browser window.
-
aspectRatio: Dimension adjusts itself proportionally according to the other dimension of the ad, and the value set for the
mdAspectRatio
variable. -
fixed: Dimensions use the value set in the
mdFixedHeight
ormdFixedWidth
variables. -
CSS selector: Dimension is according to the element on the page that includes the CSS selector.
-
Responsive ads usually resize to the same size as the element that is selected as the dependency.
-
Adaptive ads use the largest adaptive breakpoint that is less than or equal to the size of the element that is selected as the dependency. The ad uses width rather than height; therefore, the height dependency custom variable is not as useful for adaptive banners.
-
The templates include a function that tracks the current scroll position. When the ad first loads, the current scroll position is received. On any scroll, resize, or orientation change, the new scroll position is updated.
You can access the current scroll position, scrollPos.x
and scrollPos.y
, in the creative script.js
file from the global object and properties. Values are from 0 to 100 (percentage scrolled).
To include code that adjusts positioning when the scrollPositioning is updated, add your code in the onPageScroll
function in the script.js
file.
Note
Note: In some instances, there are network issues that cause the scroll detection code to fail. Make sure that you include a backup functionality for the scroll position.
The manifest file,config.js
, is a metadata file that defines certain default behaviors for an ad that is created in AAS. For more information about the manifest configuration settings, see Manifest Ad Data.
The config.js
file is located in the root folder of the workspace. The file includes the predefined default settings needed for your deluxe banner. Depending on your requirements, you can modify these settings.
Important
Important: Do not modify the value for adFormatId
. If the value is changed, the ad will not function correctly.
The following table describes the custom variables in the deluxe banner.
Variable name in AAS (variable key in config.js) |
Description |
Type |
Default and accepted values |
---|---|---|---|
Resize behavior ( |
Determines whether the ad resizes responsively, adaptively, or stays a fixed size. NoteNote: responsive_adaptive behaves responsively with respect to width, and adaptively with respect to height. Breakpoints are only used with adaptive and responsive_adaptive ads. |
String |
Default: Responsive Accepted:
|
Alignment ( |
Determines whether the banner is justified center, right, or left. |
String |
Default: Center Accepted:
|
Animate resize ( |
Determines whether the ad animates as it changes size. |
Boolean |
Default: No/false Accepted:
|
Adaptive breakpoints ( |
Sets the adaptive breakpoints the ad uses when determining whether to resize. The default value only sets width breakpoints. Breakpoints are only used when mdResizeBehavior is set to adaptive or responsive_adaptive. |
String |
Default:
Accepted: Comma delimited integers, which can also be separated by x's to specify specific heights, such as 300 x 600, 600 x 900. |
Width dependency ( |
Determines which element on the site dictates the available width for the ad. |
String |
Default: advertiserDiv Accepted:
|
Height dependency ( |
Determines which element on the site dictates the available height for the ad. When setting to advertiserdiv_adaptive, the mdAutoHeightThreshold variable determines when the height should be treated as advertiserdiv, and when it should be treated as adaptive. |
String |
Default: advertiserDiv Accepted: |
Auto height threshold ( |
This variable is only used when setting
|
Integer |
Default: 1 Accepted: > 0 |
Aspect ratio ( |
Determines the aspect ratio the ad should maintain as it resizes. |
String |
Default: Undefined Accepted: Two numbers separated by a colon, such as 16:9 or 3:4. |
Minimum width ( |
Determines the minimum width for the ad. Set to 0 for no minimum width. |
Integer |
Default: 0 Accepted: >=0 |
Minimum height ( |
Determines the minimum height for the ad. Set to 0 for no minimum height. |
Integer |
Default: 0 Accepted: >=0 |
Maximum width ( |
Determines the maximum width for the ad. Set to 0 for no maximum width. |
Integer |
Default: 0 Accepted: >=0 |
Maximum height ( |
Determines the maximum height for the ad. Set to 0 for no maximum height. |
Integer |
Default: 0 Accepted: >=0 |
Fixed width ( |
Sets a fixed width for the ad. |
Integer |
Default: 0 Accepted: >=0 |
Resize friendly iFrame ( |
Determines whether the ad attempts to resize a friendly iFrame that contains the ad. Resizing can prevent the ad from being cropped, but may affect the layout of the publisher's page. |
Boolean |
Default: No/false Accepted:
|
Auto reposition interval ( |
Ad resize/reposition interval. 0 to turn off the interval. Ad attempts to resize itself every "n" milliseconds. Even when this value is set to 0, the ad will always attempt to resize itself upon browser resize, browser scroll, or orientation change. This variable adds an interval by which to also attempt to resize/reposition. |
Number |
Default: 0 Accepted: >=0 |
Backup Img path ( |
Relative path to the backup image, if a custom image is desired. This allows a fallback experience to display an image that is not a 1x1 even though the tag is a 1x1 tag. For example, if this custom variable is set to images/300x250_Default.jpg, a file will attempt to load from the images folder. You must be sure this file exists in the workspace. When set to undefined, the normal 1 x 1 fallback occurs. |
String |
Default: Undefined Accepted: Valid relative path to an image resource. |
Parent levels to resize ( |
This variable is only used when the ad is serving a default image. When set to any value over 0, the number of publisher parent elements of our tag resizes to the default image size, if they are smaller than the default image serving. |
Integer |
Default: 0 Accepted: >=0 |
Is domain config enabled ( |
Determines whether to load the domain configuration settings. |
Boolean |
Default: No/false Accepted:
|
Prog settings folder path ( |
Location from which to load the programmatic settings files. |
String |
Default: 0 Accepted: Make sure that the default value is not modified. |
The following describes the modifications you need to make to the manifest file:
-
Name: Make sure your ad is named according to your campaign/placement.
-
Click-through URL: Update the default click-through URL according to your campaign/placement.
-
Interactions: Update this section to either include all of the interactions you have in your ad's creative, or remove the section entirely and rely just on the asset scanning of the application to detect all interactions in the code.
The following describes modifications you can make to the manifest file:
-
Custom Variables: The template provides default behavior; however, depending on, for example, the needs of your ad, and the publishers page on which the ad will run, you may need to adjust the values of some of the variables.
-
Banner Dimensions: The template provided is served as a 1x1. You may need to serve a different tag size due to certain publisher restraints. Since this ad can behave responsively, you may serve any size banner. If you decide to change your banner size, change the manifest file to match.
Functions are located in the script.js
file.
Function Name |
Description |
Additional Code Allowed |
---|---|---|
|
Initializes the creative. |
|
|
Initializes the global variables declared at the beginning of the script file. |
|
|
Initializes video tracking by creating a new instance of EBG Video Module. Available only in the video template. |
|
|
Adds click event listeners for the click-through and user action buttons, as well as resizes event listeners to check video visibility and update the text displaying the ad dimensions. |
|
|
Click event handler for user action button. |
|
|
Click handler for the click-through button. |
|
|
Resizes handler for video visibility. Available only in the video template. |
|
|
PageScroll handler to get the updated scroll position. |
|
|
Generates the dimensions and scroll position string. |
|
|
Sends a message to the application with creative version details. |
|
|
Sends a message to the application. |
|
|
Adds a custom script event listener, |
|
|
Dispatches a custom script event |
|
|
Removes a custom script event listener. |
|
|
Manages custom script events. |
Click here to preview a demo of deluxe banner format.
Comments