VOOZH about

URL: https://support.google.com/richmedia/answer/1379554?hl=en&ref_topic=25291

⇱ Studio macro exits - Studio Help


Skip to main content

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
 
Studio information is only available when the creative serves in a live tag. Studio macros return 0 or unresolved macro values when previewing in Studio. The equivalent Studio API methods return 0, null, or "" when previewing in Studio or testing locally.

If the creative is pulling exit URLs from an external source (XML, JSON) and the URLs contain Studio macro values, then you must replace the ad's macro values with the corresponding Studio API methods using string replacement logic in your creative code. Use the table above to find which macro corresponds to which Studio API method. Do not hard-code Studio macro values in your creative.

If Studio macros values are hard-coded in your creative, then the macro values will never be replaced with the corresponding Studio ad server parameters in a live tag. Also, if Studio macro values are hard-coded, then there's a chance that the URL will trigger a pop-up blocker in Internet Explorer browsers when a user clicks through from the creative. Exit URLs hard-coded in your creative cannot be overwritten in the Studio Web UI or DCM.

Examples

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
  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 helpful?

How can we improve it?

Need more help?

Try these next steps:

true
Search
Clear search
Close search
Google apps
Main menu
12710257570262224642
true
Search Help Center
false
true
true
true
true
true
74220
false
false
false
false
false