Add the Enabler

What is the DoubleClick Enabler?

The Enabler is the core code library of DoubleClick Studio. Think of it as the brain of the creative. All Rich Media components and API calls must go through the Enabler.

Why do I have to add the DoubleClick Enabler?

The Enabler component is required for all Rich Media creatives. By adding the Enabler component, you automatically ensure that your creative:

  • includes standard tracking functionality for metrics like display time, number of impressions, interactive time, and other standard metrics
  • can handle more complex features like video and expand functionality

How do I set up the Enabler?

In an HTML5 creative

Add the Enabler to the HTML file. Begin by including a script tag that links to the Enabler, which you add to the head of your HTML document:

<script src="https://s0.2mdn.net/ads/studio/Enabler.js"></script>

This provides a singleton object in the global namespace called Enabler. To call methods on it, just call Enabler.isInitialized(), Enabler.exit(), etc.

Wait for Enabler initialization

Nothing in the ad should auto-execute until the Enabler has initialized. This ensures that everything is properly loaded and Enabler methods can be accessed before a user interacts with the ad.

Once the Enabler has initialized, start animation, load in your image assets, and call tracking methods, or include other Studio modules.

How do I wait for Enabler initialization?

In your JavaScript, verify that the Enabler has initialized using the Enabler’s isInitialized method, which returns true or false. If true, make the call to start your function, in this example, enablerInitHandler(). If false, make a fallback call that listens for the Enabler’s INIT event.

// If true, start function. If false, listen for INIT.
window.onload = function() {
  if (Enabler.isInitialized()) {
    enablerInitHandler();
  } else {
    Enabler.addEventListener(studio.events.StudioEvent.INIT,
        enablerInitHandler);
  }
}

function enablerInitHandler() {
  // Start ad, initialize animation,
  // load in your image assets, call Enabler methods,
  // and/or include other Studio modules.
  // Also, you can start polite loading.
}
In a Flash (AS3) creative

The HtmlEnabler class enables creatives to be served in an HTML environment in AS3.

  • Add the Enabler to your file using ActionScript, and drag an instance of the DoubleClick Studio Library into your Flash library.

To add the Enabler, choose one of these options:

  • Option 1: To insert the Enabler in each FLA file in your creative, go to the Flash menu Commands > DoubleClick Studio v2 and select Insert v2 Studio Html Enabler.
    1. For a parent file, select OK when asked if it's the parent movie.
    2. For a child file, select Cancel.
  • This automatically imports the HtmlEnabler class into the parent creative and the ProxyEnabler into the child creatives. It also adds the Enabler component to your Flash library.
  • Option 2: As another option, drag the Enabler icon  to the Library of both your parent and child files and add this code to the parent:
    import com.google.ads.studio.HtmlEnabler;
    
    // Get a reference to the HtmlEnabler;
    var enabler:HtmlEnabler = HtmlEnabler.getInstance();
    
    // Initialize the HtmlEnabler. The "this" keyword refers to the stage.
    enabler.init(this);

    ...and this code to any child Flash assets:

    import com.google.ads.studio.ProxyEnabler;
    
    // Get a reference to the ProxyEnabler;
    var enabler:ProxyEnabler = ProxyEnabler.getInstance();
    

Using either of these options to set up your Enabler, you can always access the HtmlEnabler class through the variable enabler.


The ProxyEnabler is required in all child assets that make Enabler API calls. This class proxies all API calls to the parent Enabler. Unlike the parent Enabler, the child Enabler doesn't require initialization and helps save file size in your creative. You simply import it before making an Enabler API call. When used, the ProxyEnabler appears to dispatch the same events as the parent Enabler.

Android-style image of the author of this page

Sarah is a DoubleClick Studio expert and author of this help page. Help her improve this article by leaving feedback below.

Was this article helpful?
Yes
No