How to use dynamic exit URLs

Objective

Use an exit URL from an external data source (such as Google Sheets, an XML feed, or Google Merchant Center) instead of entering it in Studio, Campaign Manager 360 or Google Ad Manager. 

Solution

The Enabler.exitOverride(id, url) method from the Studio HTML5 SDK overrides any exit URL entered in Studio, Campaign Manager 360, or Ad Manager.

Examples

Set up a string variable, exitURL, to hold the destination URL in your creative. The URL can be passed in dynamically through XML, sourced from a dynamic feed, or hard-coded.

Use an exit URL from a dynamic feed in Google Web Designer

  1. In the Dynamic panel, click + to add dynamic bindings.
  2. On the Bindings tab of the Dynamic Properties dialog, click Add Binding.
  3. For the element, select the ID of the Tap Area.
  4. For the element attribute, select Exit override URL.
  5. For the data schema object, select the object from your feed that represents the dynamic URL (e.g., Product.0.url).

Dynamic Exits in Studio - Google Web Designer

Use an exit URL from a dynamic feed in JavaScript

// Replace the dynamicContent value below with your own dynamic element value.
var exitURL = dynamicContent.Feed_1[0].ExitURL.Url;

function exitClickHandler() {
  Enabler.exitOverride("exit name goes here", exitURL);
}

exitButton.addEventListener('click', exitClickHandler, false);

Use a hard-coded exit URL in JavaScript

Only use a hard-coded exit URL when you know the URL will not need to be changed later. If you do need to change it, you'll have to update the creative code and resubmit the creative for trafficking. 

// productId is a value calculated elsewhere in the code, and
// is not shown in this example.
var exitURL = "http://yoursite.com?product=" + productId;

function exitClickHandler() {
  Enabler.exitOverride("exit name goes here", exitURL);
}

exitButton.addEventListener('click', exitClickHandler, false);

 

Add values or parameters to dynamic exit URLs

Add third-party tracking to dynamic exit URLs with an additional method in your creative's JavaScript code to retrieve parameters set in Campaign Manager 360. Use the Enabler.getParameter method to get the landing page suffix value (stored in the exit_suffix macro) and append it to exit URLs from an associated dynamic feed.

Step 1: Add code to your creative

Using one of the options below, add code to your creative to combine the dynamic exit URL with the suffix from Campaign Manager 360.

Combine the dynamic exit URL and suffix in Google Web Designer

  1. Click the Tap Area where you want to apply the dynamic exit and suffix to.
  2. Add a new event (click the "+" button on the events panel).
  3. Select Tap Area > Touch/Click on the Event step.
  4. On the Action step, select Custom > Add custom action Add custom action
  5. Add a function name, then paste the following custom code in the text area. Replace the example exit URL with your own exit URL.
  6. Click OK.
// Replace the dynamicContent value below with your own dynamic element value.
var exitURL = dynamicContent.Feed_1[0].ExitURL.Url;
var urlSuffix = Enabler.getParameter('exit_suffix'); 
var symbol = (exitURL.indexOf('?') > -1) ? '&': '?'; 
if (urlSuffix) { 
  while (urlSuffix.charAt(0) == '?' || urlSuffix.charAt(0) == '&') { 
    urlSuffix = urlSuffix.substring(1); 
  } 
  if (urlSuffix.indexOf('?') > -1) { 
    urlSuffix = urlSuffix.replace(/\?/g, '&'); 
  } 
} 
exitURL = exitURL + symbol + urlSuffix;

Enabler.exitOverride('exit', exitURL);

Custom code to add a dynamic exit suffix
Combine the dynamic exit URL and suffix using JavaScript in any HTML editor

If you use an HTML editor other than Google Web Designer, use a JavaScript method like the one below to get the exit suffix from Campaign Manager 360. Before you can call this function, you need to load and initialize the Enabler.

function addSuffix(url, dcmParameter) { 
  var urlSuffix = Enabler.getParameter(dcmParameter); 
  var _url = ''; 

  if (url) { 
    var symbol = (url.indexOf('?') > -1) ? '&': '?'; 
    if(urlSuffix) { 
      while (urlSuffix.charAt(0) == '?' || urlSuffix.charAt(0) == '&') { 
        urlSuffix = urlSuffix.substring(1); 
      } 
      if (urlSuffix.indexOf('?') > -1) { 
        urlSuffix = urlSuffix.replace(/\?/g, '&'); 
      } 
    } 
    _url = url + symbol + urlSuffix; 
  } 
  return _url; 
} 

// Example of how you would use this function:
exitUrl = addSuffix(exitUrl, 'exit_suffix'); 

Step 2: Add the URL parameters in Campaign Manager 360

After adding your creative to Campaign Manager 360, enter the query parameters that will be appended to your exit URL by adding a landing page suffix.

Choose where to add the suffix based on where it should be applied:

  • All landing pages in all campaigns: Add the suffix in advertiser properties.
  • All landing pages in a campaign: Add the suffix in campaign properties.
  • All creatives assigned to an ad: Add the suffix in ad properties.

Set the suffix at the highest level to apply it across more creatives. You can override the suffix by setting it at a more specific, lower level. For example, if you set a suffix in your advertiser properties, any suffixes set in the campaign or ad properties will override the advertiser-level suffix.

Add a landing page suffix

  1. Open the ad, campaign, or advertiser properties, and click Landing page URL suffix
  2. Enter your full suffix in the text box. Suffixes can include multiple query parameters, but must be 128 characters or less. If the suffix is inherited, you can edit it in the parent or turn off Inherit URL suffix. When inheritance is turned on, the suffix from the parent is used. An inherited suffix for a campaign comes from the advertiser settings. An inherited suffix in an ad comes from the campaign settings.
  3. Campaign Manager 360 identifies any key-value pairs in the suffix and allows you to edit them below the field as query parameters. You can choose macros or enter custom strings. To remove a key-value pair, click Delete .

Example of landing page URL suffix settings

Landing page URL suffix settings and key-value editor in Campaign Manager 360.

Learn more about landing page suffixes in the Campaign Manager 360 Help Center

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

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