PRODUCT
Follow

Note

Note: To learn more about this format, preview a demo, or to see build guides for other authoring tools, see About Deluxe Banner.

Creating an Ad Using a Sizmek Ad Suite Template

When creating a Deluxe Banner in a code editor, it is recommended that you start with our official template.

Template

Download

Deluxe Banner Basic

DeluxeBanner_2.0.0.zip

Deluxe Banner with Video

DeluxeBanner_Video_2.0.0.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.

Included Files

The following table describes the list of files that are included in the downloadable template.

File Name

Description

Required

index.html

HTML file for the banner.

Required

config.js

Configuration/Manifest file for the ad. Used for actions such as default ad settings, and Dynamic Creative.

Required

styles/reset.css

Resets the native styles of the browser so that the ad can look as intended.

Optional

styles/style.css

Style sheet for the banner and its HTML elements.

Required

scripts/script.js

JavaScript (logic and tracking) for the banner.

Required

scripts/localPreview.js

Script that enables local preview of the ad.

Optional

images/logo.png

Sizmek Ad Suite logo. Replace this logo with your own logo, or delete this image if it is not needed.

Optional

images/backup.jpg

Fallback image shown in unsupported browsers.

Required

Additional Files in the Video Template

File Name

Description

Required

videos/video.mp4

Temporary video that you should replace with your own video.

Required

images/background.jpg

Temporary background image for the banner that you should replace with your own background image.

Optional

images/play.svg

Play button for the video.

Required

images/poster.jpg

Poster image displayed in the video location in the banner before the video starts and after the video ends.

Optional

Test Your Deluxe Banner Locally

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.

Setting up Your Ad in Sizmek Ad Suite

After you finish creating your ad, proceed to setting up your ad in SAS. For more information, see Set up a Deluxe Banner.

Additional Resources

Preparing for Bulk Upload

If you are planning to upload multiple ads, make sure that the Ad Creation Wizard in SAS 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.

Shared Libraries

If you are developing ads with 3rd 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.

Dynamic Creative Optimization

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.

Advanced Configuration

The following sections describe common methods to use to customize your Deluxe Banner.

Responsive Banners

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.

Adaptive Banners

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.

Fixed-Sized Banners

Perform the following procedure if you want the banner to display at a specific height and width.

Procedure
  1. Set mdResizeBehavior to fixed.

  2. Use the mdFixedHeight and mdFixedWidth custom variables to set a fixed and width.

Modify Height and Width Dependencies

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 or mdFixedWidth 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.

Detect Scroll Position

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.

Manifest Configuration File

The Manifest file,config.js, is a metadata file that defines certain default behaviors for an ad that is created in SAS. 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 SAS

(Variable Key in config.js)

Description

Type

Default and Accepted Values

Resize Behavior

(mdResizeBehavior)

Determines whether the ad resizes responsively, adaptively, or stays a fixed size.

Note

Note: 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:

  • responsive

  • adaptive

  • fixed

  • responsive_adaptive

Alignment

(mdAlignment)

Determines whether the banner is justified center, right, or left.

String

Default: Center

Accepted:

  • center

  • c

  • right

  • r

  • left

  • l

Animate Resize

(mdAnimateResize)

Determines whether the ad animates as it changes size.

Boolean

Default: No/false

Accepted:

  • Yes/No

  • true/false

Adaptive Breakpoints

(mdAdaptiveBreakpoints)

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:

  • 300

  • 600

  • 900

  • 1200

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

(mdWidthDependency)

Determines which element on the site dictates the available width for the ad.

String

Default: advertiserDiv

Accepted:

  • advertiserDiv or 1

  • browser or 2

  • aspectRatio or 3

  • fixed or 4

  • Any CSS selector

Height Dependency

(mdHeightDependency)

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:

  • advertiserDiv or 1

  • browser or 2

  • aspectRatio or 3

  • fixed or 4

  • advertiserDiv_adaptive or 5

  • Any CSS selector

Auto Height Threshold

(mdAutoHeightThreshold)

This variable is only used when setting mdHeightDependency to advertiserDiv_adaptive.

  • If the advertiser element’s height is greater than the mdAutoHeightThreshold value, the ad behaves as it would if the mdHeightDependency were set to the advertiserdiv behavior.

  • If the height of the element is the same or less than the value of mdAutoHeightThreshold, then the ad behaves adaptively, utilizing the breakpoints set in mdAdaptiveBreakpoints

Integer

Default: 1

Accepted: > 0

Aspect Ratio

(mdAspectRatio)

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

(mdMinimumWidth)

Determines the minimum width for the ad. Set to 0 for no minimum width.

Integer

Default: 0

Accepted: >=0

Minimum Height

(mdMinimumHeight)

Determines the minimum height for the ad. Set to 0 for no minimum height.

Integer

Default: 0

Accepted: >=0

Maximum Width

(mdMaximumWidth)

Determines the maximum width for the ad. Set to 0 for no maximum width.

Integer

Default: 0

Accepted: >=0

Maximum Height

(mdMaximumHeight)

Determines the maximum height for the ad. Set to 0 for no maximum height.

Integer

Default: 0

Accepted: >=0

Fixed Width

(mdFixedWidth)

Sets a fixed width for the ad.

Integer

Default: 0

Accepted: >=0

Resize Friendly iFrame

(mdResizeFriendlyIframe)

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:

  • Yes/No

  • true/false

Auto Reposition Interval

(mdAutoRepositionInterval)

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

(mdBackupImgPath)

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 1 x 1 even though the tag is a 1 x 1 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

(mdParentLevelsToResize)

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

(mdIsDomainConfigEnabled)

Determines whether to load the domain configuration settings.

Boolean

Default: No/false

Accepted:

  • Yes/No

  • true/false

Prog Settings Folder Path

(mdProgSettingsFolderPath)

Location from which to load the programmatic settings files.

String

Default: 0 //services.serving-sys.com/programmatic/DomainList/

Accepted: Make sure that the default value is not modified.

Recommended Changes to Manifest File Configuration

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 1 x 1. 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

Functions are located in the script.js file.

Function Name

Description

Additional Code Allowed

checkIfAdKitReady

Checks to see if the AdKit is ready, and then proceeds to initialize creative.

DOC_cross_blue.jpg

initializeCreative

Initializes the creative.

DOC_tick.gif

initializeGlobalVariables

Initializes the global variables declared at the beginning of the script file.

DOC_tick.gif

initializeVideo

Initializes video tracking by creating a new instance of EBG Video Module. Available only in the video template.

DOC_tick.gif

addEventListeners

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.

DOC_tick.gif

handleUserActionButtonClick

Click event handler for user action button.

DOC_tick.gif

handleClickthroughButtonClick

Click handler for the click-through button.

DOC_tick.gif

checkIfVideoIsVisible

Resizes handler for video visibility. Available only in the video template.

DOC_cross_blue.jpg

onPageScroll

PageScroll handler to get the updated scroll position.

DOC_cross_blue.jpg

displayDimensions

Generates the dimensions and scroll position string.

DOC_tick.gif

setCreativeVersion

Sends a message to the application with creative version details.

DOC_cross_blue.jpg

sendMessage

Sends a message to the application.

DOC_cross_blue.jpg

addCustomScriptEventListener

Adds a custom script event listener,

DOC_cross_blue.jpg

dispatchCustomScriptEvent

Dispatches a custom script event

DOC_cross_blue.jpg

removeCustomScriptEventListener

Removes a custom script event listener.

DOC_cross_blue.jpg

eventManager

Manages custom script events.

DOC_cross_blue.jpg
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments