Rich media developer's guide

DoubleClick Studio macro exits

Objective

Insert DoubleClick information/macros into your exit URL.

Solution

There are two ways to add DoubleClick information, like an ad ID, to an ad:

  • Use DoubleClick macros in the destination URL in the DoubleClick Studio Web UI.
  • Use the Studio API to get DoubleClick information, building a query string or full URL in your creative code. Then use the Enabler.exitQueryString(id, queryString).

When you use dynamic exit URLs, the landing page may redirect to a different URL. This is controlled by the landing page server, not DoubleClick.

Set up

Before you add DoubleClick macros to exits, see the chart below for information on available macros and their equivalent Studio API calls:

Macros supported by DoubleClick Studio

Macro
DoubleClick Studio API method
DoubleClick ad server parameter
%eadv! Enabler.getParameter("adv"); advertiser ID
%eaid! Enabler.getDartAdId(); ad ID
%ebuy! Enabler.getParameter(“buy”); campaign ID
%ecid! Enabler.getDartCreativeId(); creative ID
%epid! Enabler.getDartPageId(); placement ID
%erid! Enabler.getDartRenderingId(); rendering ID
%esid! Enabler.getDartSiteId(); site ID
%n No API available random number
%p No API available pattern match
%s Enabler.getDartSiteName(); site name
 

Examples

Use DoubleClick macros in the destination URL in the Studio Web UI

Paste the landing page URL that contains the DoubleClick macro data into the Destination URL field in the Events > Exits tab.

Sample third-party redirect URL
Macros are highlighted red in this example.

http://yourdomain.com/clk?aAgencyId=01&aSource=adsrv&aTrackDataExt=
123456;%epid!
;%eaid!;%ecid!&migRandom=%n&aTrackFmtExt=client;io;ad;crtv&
aUnencodedDest=http://yourdomain.com

 

Use DoubleClick parameters as an exit query string in your creative

If you want to add DoubleClick parameters to an exit URL, make sure there's a corresponding Studio API method for it. If there's no Studio API method, you can't pull the DoubleClick information into the exit URL.

Use the exitQueryString method

  1. Append the Studio API methods that correspond to each of the DoubleClick parameters in the second parameter of the exitQueryString method. The available methods are listed in the Studio HTML5 SDK (search the page for "getDart" to go directly to the list). Here's a JavaScript code sample for HTML5 creatives:
    
    var adIdVar = Enabler.getDartAdId();
    var siteIdVar = Enabler.getDartSiteId();
    
    function exitHandler() {
      Enabler.exitQueryString("my exit", "adid=" + adIdVar + "&siteid=" + siteIdVar);
    }
    
    exitBtn.addEventListener('click', exitHandler, false);
    Flash example
    var adIdVar:int = enabler.getDartAdId();
    var siteIdVar:int = enabler.getDartSiteId();
    
    function onExitHandler(event:MouseEvent):void {
      enabler.exitQueryString("my exit", "adid=" + adIdVar + "&siteid=" + siteIdVar);
    }
    
    exitBtn.addEventListener(MouseEvent.CLICK, onExitHandler);

    As an alternative in Flash only, you can add the entire exit URL with the corresponding DoubleClick parameters in the second parameter of the exit method.

    var adIdVar:int = enabler.getDartAdId();
    var siteIdVar:int = enabler.getDartSiteId();
    
    function onExitHandler(event:MouseEvent):void {
      enabler.exit("my exit", "http://yourdomain.com/?adid=" + adIdVar + "&siteid=" + siteIdVar);
    }
    
    exitBtn.addEventListener(MouseEvent.CLICK, onExitHandler);
  2. Add the base URL in the destination URL field in the Events > Exits tab.

    For example, using http://yourdomain.com/ as the base URL, the resulting URL that the ad clicks out to might look like this when the ad is on a live tag:

    http://yourdomain.com/?adid=123456789&siteid=12345

Was this article helpful?