Rich media developer's guide

Studio macro exits

Objective

Insert Studio information/macros into your exit URL.

Solution

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

  • Use Studio macros in the destination URL in the Studio Web UI.
  • Use the Studio API to get Studio 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 Studio.

Set up

Before you add Studio macros to exits, see the chart below for information on available macros and their equivalent Studio API calls. If you want to add Studio parameters to an exit URL directly in your creative code, make sure there's a corresponding Studio API method for it. If there's no Studio API method, you can't pull the Studio information into the exit URL.

Macros supported by Studio

Macro
Studio API method
Studio 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 Studio macros in the destination URL in Studio

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

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 Studio parameters in the creative's code, then enter the base URL in Studio
  1. Instead of using the Enabler.exit() method in your code, replace the exit you want to add parameters to with Enabler.exitQueryString(). This method allows you to set a base URL in Studio and append parameters to that base URL in the creative's code.
  2. Append the Studio API methods that correspond to each of the Studio 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);
  3. 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?
How can we improve it?