31.07.2013 Views

Build Guide

Build Guide

Build Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

.Swipe for More.<br />

HTML5 Component.<br />

Introduction.<br />

.Rich Media HTML5 <strong>Build</strong> <strong>Guide</strong>.<br />

.JULY 2012 .<br />

Mobile devices are heavily constrained for screen real estate and so creative methods are needed in order to<br />

maximize the usage of available space. One such method popular on iOS and Android devices is the availability of<br />

a pulldown "curtain." This curtain layer is a window that the user can swipe down from the top of the screen, so we<br />

took this idea and created Swipe for More<br />

Swipe for More gives you a ready made draggable curtain that you can place into any creative and customise<br />

however you see fit. Increase your creative canvas quickly and simply with the Swipe for More curtain and provide<br />

space to present to the user a multitude of extra images, videos, maps or whatever else you might need just that<br />

little bit of extra space for.<br />

A preview of a creative using the Swipe for More HTML5 component can be found here.


.<strong>Build</strong> &.<br />

.Delivery.<br />

Swipe For More is a configurable HTML5 template that can be applied to any HTML5 ad. Developers can configure<br />

the swipe for more curtain attributes such as the color, the dimension, animation speed and an array of other<br />

aspects of the component which will be explained in more detail below. Once the curtain is swiped down, it can be<br />

treated as a brand new blank canvas and so developers can add any additional arbitrary content to it. It is up to the<br />

developer to properly position images, video, maps, and other components on this canvas (the canvas is a standard<br />

DIV). In this demo the canvas has been used to contain 4 thumbnail images each of which when clicked takes the<br />

user to a new larger image.<br />

.NOTE:. This format is initially supported only on WebKit-based browsers (Android, iOS, desktop Chrome and Safari). For initial deployment it is<br />

recommended that you explicitly target mobile Android and iOS.<br />

.NOTE:. If you have any questions or comments about this format then please feel free to reach out to our technical team via .dclk-<br />

drmtechnical@google.com.<br />

Demo files for this creative can be found .here.<br />

A breakdown of the files and how they work can be found below:<br />

.1.. swipeformore.html (300x250 inpage)<br />

This is the HTML page which contains the HTML5 creative itself, it creates and calls the container which the creative<br />

will appear in and also contains the DoubleClick HTML5 Enabler.<br />

The Enabler contains all of the tracking calls and functionality which allows this creative to work within the<br />

DoubleClick Studio platform and should be added to the head of your HTML as follows:<br />

<br />

<br />

<br />

.NOTE:. Additional information on setting up HTML5 creatives within DoubleClick Studio and the use of the Enabler can be found .here.<br />

.2.. swipeformore.css, swipeformore.js, modernizr.js<br />

These are required CSS and JS files which form the basis of the swipe gallery component. They contain all of the<br />

script and functionality of the swipe gallery and as such need to be included within the head of the HTML as follows:<br />

<br />

<br />

<br />


.3.. s4m_demo.css, s4m_demo.js<br />

These are required CSS and JS for this demo which contain all of the actual content which will be pulled into the<br />

container within the HTML page<br />

<br />

<br />

<br />

.4.. thumb_1.png, thumb_2.png, thumb_3.png, thumb_4.png<br />

These are the thumbnail images which are pulled into the Swipe for More curtain.<br />

.5.. image_1.png, image_2.png, image_3.png, image_4.png<br />

These are the large images which are shown when the thumbnails within the swipe for more curtain are pressed.<br />

.6.. tab.png. grip.png<br />

These are the images which make up the Swipe for More curtain.<br />

.7.. background_image.jpg<br />

This is the backup image for the creative which will display if the creative is viewed by a non HTML5 compliant<br />

browser. It should be the size of the creative, so in this case 300x250px<br />

.Using the Component.<br />

.>. Configuration<br />

The goal of this mobile component is to be as flexible as possible especially around its configuration. In order to set<br />

it up a config object is created in JavaScript (shown below) and then passed to the component.<br />

.NOTE:. This config for the demo downloadable from this document is done within the s4m_demo.js file.<br />

// Swipe For More config object.<br />

var config = {<br />

// Id of div container that will hold the Swipe 4 More component.<br />

adContainerId: 'swipe-container',<br />

// File path of the swipeable tab image.<br />

outerTabFilepath: Enabler.getUrl('tab.png'),<br />

// Dimensions of the outer swipeable tab image.<br />

outerTabDimensions: {<br />

width: 300,<br />

height: 37<br />

},<br />

// Amount of space to increase the tab swipe hit area by in pixels.<br />

tabHitAreaIncrease: 15,<br />

// File path of the inner tab image that appears inside the swipe pane.<br />

innerTabFilepath: Enabler.getUrl('grip.png'),<br />

// Dimensions of the inner tab image.<br />

innerTabDimensions: {<br />

width: 47,<br />

height: 17<br />

},<br />

// Because the outer tab and inner images differ, there could be an


alignment problem. This pixel offset can be adjusted to correct<br />

// this.<br />

innerTabOffset: 7,<br />

// Distance between bottom edge and the inner tab image.<br />

innerTabBottomMargin: 10,<br />

// The solid color of the main swipeable pane. Rgba is used because<br />

// children do not inherit the opacity of parents.<br />

backgroundRgba: 'rgba(82, 214, 247, 0.90)',<br />

// Opacity of the gradient div. The actual gradient effect is defined in<br />

// s4m.css.<br />

gradientOpacity: .3,<br />

// Time (in ms) it takes for expand/retract of the swipeable pane.<br />

animationDuration: 800,<br />

shouldTease: true,<br />

// Starting z-index for the Swipe 4 More component.<br />

zIndexStart: 8000<br />

};<br />

// Create an instance of the Swipe 4 More component, passing in config.<br />

var mySwipe4More = new<br />

studio.innovation.components.SwipeForMore(config);<br />

mySwipe4More.render(document.getElementById('swipe-container'));<br />

// Four Image Gallery config object.<br />

var imgConfig = {<br />

// Div container that will hold the gallery.<br />

adContainer: mySwipe4More.getMainContentArea(),<br />

// Padding around thumbnails.<br />

thumbnailPadding: {<br />

paddingLeft: 10,<br />

paddingRight: 10,<br />

paddingTop: 8,<br />

paddingBottom: 5<br />

},<br />

// Dimensions of thumbnails.<br />

thumbnailSize: {<br />

width: 113,<br />

height: 94<br />

},<br />

// Filepaths to thumbnails and corresponding image. Also contains<br />

// corresponding CTA objects defined above.<br />

images: [ {thumb: Enabler.getUrl('thumb_1.png'), image: Enabler.getUrl('image_1.png')},<br />

{thumb: Enabler.getUrl('thumb_2.png'), image: Enabler.getUrl('image_2.png')},<br />

{thumb: Enabler.getUrl('thumb_3.png'), image: Enabler.getUrl('image_3.png')},<br />

{thumb: Enabler.getUrl('thumb_4.png'), image: Enabler.getUrl('image_4.png')} ],<br />

// Border for the large image. Can be set to null for no border.<br />

imageBorderColor: '#FFF',<br />

// Dimensions of the close X button.<br />

closeButtonSize: {<br />

width: 26,<br />

height: 24<br />

},<br />

fadeClass: 's4m-image-fade',<br />

// Starting z-index for the component.<br />

zIndexStart: 9000<br />

};


.NOTE:. Enabler.getUrl() is required when loading in an image within Studio to make sure that studio can locate the file properly when adserved.<br />

For more information check out our help centre .here.<br />

.>. Instantiation and Event Handling<br />

Instantiating the component is straightforward and is done as follows:<br />

var mySwipe4More = new studio.innovation.components.SwipeForMore(config);<br />

.NOTE:. This is again done for the downloadable demo from this document within the s4m_demo.js file.<br />

Immediately following instantiation, you can set up listeners and callback for the SWIPE_OPEN and SWIPE_CLOSE<br />

custom events. In place of the console.log, it is typical to invoke the Studio HTML5 Enabler.<br />

mySwipe4More.addEventListener(studio.innovation.components.SwipeForMore.SWIPE_OPEN, function() {<br />

console.log('open');<br />

Enabler.counter("HTML5 Counter - Open Swipe For More Container");<br />

}, false);<br />

mySwipe4More.addEventListener(studio.innovation.components.SwipeForMore.SWIPE_CLOSE,<br />

function() {<br />

console.log('close');<br />

Enabler.counter("HTML5 Counter - Close Swipe For More Container");<br />

}, false);<br />

.NOTE:. The Enabler.counter() call is a custom Rich Media counter which will appear within the Rich Media report for your creative, allowing you<br />

to easily see which of your images was viewed the most. For more information on setting up Rich Media Counters see our help centre .here.<br />

Finally, to actually show the component you must call the render method and supply the parent container. The<br />

parent container can be any valid element.<br />

mySwipe4More.render(document.getElementById('swipe-container'));<br />

IMPORTANT: This component relies on the latest CS3 effects (specifically, CSS transitions and CSS transforms).<br />

The component uses Modernizr to sniff out these capabilities, and if it does not detect them the swipe pane and<br />

tab will NOT load. The recommended strategy is to include a static image within the parent DIV container that will<br />

contain Swipe For More.<br />

Example:<br />

<br />

/* The content below serves as the backdrop to your ad, over which the swipe pane<br />

* gets placed. In this example, a static JPG is the backdrop and will be shown<br />

* regardless of whether the user’s device can support Swipe For More.<br />

*/<br />

<br />

<br />

Other API Methods.<br />

.>. Programmatically Opening and Closing of the SwipeForMore Object.<br />

To open the main content area of the SwipeForMoreObject:


function openSwipeAreaHandler(event) {<br />

mySwipe4More.openSwipePane();<br />

}<br />

openSwipeAreaBtn.addEventListener(‘click’, openSwipeAreaHandler, false);<br />

To close the main content area of the SwipeForMoreObject:<br />

function closeSwipeAreaHandler(event) {<br />

mySwipe4More.closeSwipePane();<br />

}<br />

closeSwipeAreaBtn.addEventListener(‘click’, closeSwipeAreaHandler, false);<br />

.>. Accessing the Main Content Area of the SwipeForMore Object.<br />

To access the main content area of the SwipeForMore object:<br />

mySwipe4More.getMainContentArea();<br />

Additional Notes.<br />

Once finished, your creative and all of its files should be uploaded to Studio exactly as you would do with any other Rich<br />

Media creative, for more information on uploading to Studio check out the help centre .here.<br />

Swipe for More is compatible with any HTML5 format that’s uploaded to DoubleClick Studio and some more<br />

advanced sample files which use the Swipe for More HTML5 component can be downloaded from the Resources<br />

section below.<br />

.Resources.<br />

.>. [DEMO] Swipe Gallery<br />

.>. [FILES] Inpage Demo (Basic)<br />

.>. [FILES] Inpage with Video Demo (Advanced)<br />

.>. [FILES] Expanding Demo (Advanced)<br />

.>. [HELP DOCUMENTATION] Studio link to HTML5 Information<br />

.>. [HELP DOCUMENTATION] Studio Enabler API/SDK Information<br />

.>. [HELP DOCUMENTATION] Setting up your creative in Studio<br />

.>. DoubleClick Rich Media Help Center<br />

.>. DoubleClick Rich Media Studio<br />

.>. DoubleClick Rich Media Gallery<br />

.>. @rmgallery - DoubleClick Rich Media Gallery Twitter Account


Contact Us.<br />

If you still have any questions relating to this format or build then please feel free to contact our Rich Media<br />

Technical Support team through Doubleclick’s Help Center Contact Us form.<br />

About DoubleClick.<br />

For advertisers and publishers who need to reach a target audience, the Google’s DoubleClick product suite is<br />

an advertising platform that maximizes revenue growth and return on advertising spend through a unique and<br />

innovative ad targeting process. The experience and innovative spirit at DoubleClick drives a constant evolution of<br />

products and solutions, ensuring the best, most effective advertising tools are always at our customers’ command.<br />

.www.doubleclick.com.<br />

.www.richmediagallery.com.<br />

.DoubleClick NY: 76 Ninth Ave, New York, NY 10011<br />

.www.google.com/doubleclick ©2012 Google Inc. All rights reserved..

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!