Help Center Manage Your Account Ad Tag

How do I pass custom data and variables into the ad?

You can pass a custom value into the ad tag and our ad server will pass that same value along to the actual ad. This is useful when the ad displays dynamic content based on certain input. This feature can also be used for customized tracking or logging. For example, an ad displays today's interest rate for a mortgage loan that needs the actual interest rate supplied from outside.

Setup

  1. Append &custom=Your+Ad+Data to the ad tag. You can append the variable manually or enter it into Custom Parameters field when generating the ad tag
  2. Add the macro/placeholder {AS:Serving:Custom} (or {AS:Serving:CustomEncoded} for URL-encoded value) into the ad at the location where you want the actual data to be replaced.

Example - Dynamic Interest Rate

You want to display an ad that shows the best mortgage rate for a 30-year loan in a certain city.
  1. The ad tag has these pass-along parameters:
    ad.php?...&custom=Gilroy&custom1=4.25
  2. The ad has these custom-data macros/placeholders inside its ad copy:
    Need a 30-year loan in {AS:Serving:Custom}? 
    Today's best rate is {AS:Serving:Custom1}% APR
  3. When this ad is served, our ad engine will replace the macro/placeholder {AS:Serving:Custom} with the actual value of Gilroy supplied from the ad tag. The result ad would display:
    Need a 30-year loan in Gilroy? 
    Today's best rate is 4.25% APR

Example - Cruise Line with Destination

In this example, you want to customize a travel cruise ad with the destination and the cruise line. The two custom parameters are provided to the ad tag and they will then be passed along to the ad itself, which could be a third-party URL, a landing page URL, a custom image URL, or some HTML code in a Rich-Media/HTML ad.
  1. Pass this into the ad request:
    ad.php?...&custom=Panama&custom1=Norwegian
  2. Edit the ad's click URL with the pass-along/custom parameters:
    landing.page/cruise?destination={AS:Serving:Custom}&company={AS:Serving:Custom1}
  3. The actual landing page for this ad would become:
    landing.page/cruise?destination=Panama&company=Norwegian

Available Pass-Along Parameters

You can have up to 16 custom params:
Input ParameterPlaceholderURL-encoded Placeholder
custom{AS:Serving:Custom}{AS:Serving:CustomEncoded}
custom1{AS:Serving:Custom1}{AS:Serving:CustomEncoded1}
custom2{AS:Serving:Custom2}{AS:Serving:CustomEncoded2}
custom3{AS:Serving:Custom3}{AS:Serving:CustomEncoded3}
custom4{AS:Serving:Custom4}{AS:Serving:CustomEncoded4}
custom5{AS:Serving:Custom5}{AS:Serving:CustomEncoded5}
custom6{AS:Serving:Custom6}{AS:Serving:CustomEncoded6}
custom7{AS:Serving:Custom7}{AS:Serving:CustomEncoded7}
custom8{AS:Serving:Custom8}{AS:Serving:CustomEncoded8}
custom9{AS:Serving:Custom9}{AS:Serving:CustomEncoded9}
custom10{AS:Serving:Custom10}{AS:Serving:CustomEncoded10}
custom11{AS:Serving:Custom11}{AS:Serving:CustomEncoded11}
custom12{AS:Serving:Custom12}{AS:Serving:CustomEncoded12}
custom13{AS:Serving:Custom13}{AS:Serving:CustomEncoded13}
custom14{AS:Serving:Custom14}{AS:Serving:CustomEncoded14}
custom15{AS:Serving:Custom15}{AS:Serving:CustomEncoded15}

VAST Video Ad

Pass-along parameters are also commonly used for video ads. A VAST-wrapper ad chain goes through multiple video ad servers. In order to select the right ad, a video ad server often needs data from the upstream ad server or from the publisher/website. To do that, those bits of information (video title, video description, keywords, etc.) are passed along via ad macros from one ad server to another ad server. For example, you can pass data from Roku to AdSpeed and then from AdSpeed to a third-party VAST wrapper. First, generate the VAST ad request for the zone and then add Roku macros to it:
ad.php?do=vast&zid=xxxx...&custom=ROKU_ADS_APP_ID&custom1=ROKU_ADS_APP_VERSION
Second, edit the ad in your account and add AdSpeed pass-along macros to the third-party VAST wrapper URL:
other-video-adserver/?appname={AS:Serving:CustomEncoded}&appversion={AS:Serving:CustomEncoded1}

Integration - Passing value from page URL

You can pass values from the page URL's query string into the ad tag. The ad tag then in turn can continue to pass that same value to the ad's components or to other third-party ad tags. For example, this is your website URL and you want to pass ProductID into the ad serving tag:
https://example.com/mypage.html?ProductID=1234
You can do it via server-side or client-side code. Here is one example with client-side JavaScript:
var urlParams = new URLSearchParams(window.location.search);
var myParam = urlParams.get('ProductID');
var extras = '';
if (myParam) {
	extras = '&custom='+encodeURIComponent(myParam);
} // fi

var adRequest = 'https://g.adspeed.net/ad.php?do=js&zid=xxx&oid=xxxx&wd=-1&ht=-1&target=_blank'+extras;
document.write('');

Other Articles in Ad Tag

This section describes the ad tag (serving code) with basic and advanced settings. It includes common ad serving setup instructions and answers frequently asked questions when integrating the ad tag into your site, blog or app.

Cannot find an answer for your question? Ask our Customer Care team

Related