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
- 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 - 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.- The ad tag has these pass-along parameters:
ad.php?...&custom=Gilroy&custom1=4.25
- 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
- When this ad is served, our ad engine will replace the macro/placeholder
{AS:Serving:Custom}
with the actual value ofGilroy
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.- Pass this into the ad request:
ad.php?...&custom=Panama&custom1=Norwegian
- Edit the ad's click URL with the pass-along/custom parameters:
landing.page/cruise?destination={AS:Serving:Custom}&company={AS:Serving:Custom1}
- 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 Parameter | Placeholder | URL-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_VERSIONSecond, 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 passProductID
into the ad serving tag:
https://example.com/mypage.html?ProductID=1234You 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.
- Accelerated Mobile Pages Project - AMP Ad Tag
- Can I have ads refresh automatically without a page reload?
- How can I avoid document.write warning in Chrome?
- How can I avoid duplicate ads on the same page?
- How can I combine multiple ads in the same placement?
- How can I defer ads until after the page has finished loading?
- How can I display an ad only when it is visible on screen?
- How can I measure ad viewability?
- How can I mix ad dimensions or mix banners with text-link ads?
- How can I put ads into my blog/website?
- How can I serve multiple ad dimensions in the same place?
- How can I serve multiple zones with a single server request?
- How can I support click tracking for external ad servers?
- How can I turn off ad serving error messages?
- How do I add current timestamp into the serving code?
- How do I display mobile ads using Android WebView?
- How do I display mobile ads using Apple iOS WKWebView?
- How do I integrate AdSpeed mobile ad serving API?
- How do I make ads responsive on mobile devices?
- How do I set up advertising on WordPress?
- How do I setup a companion ad in video ad serving?
- How do I setup a passback ad tag?
- How do I switch to secure SSL/https ad serving?
- Should I use protocol-relative URLs in ad tags?
- What are custom ad serving settings and variables?
- What are different formats of serving code?
- What are different types of ad tag?
- What are the effects of ad blocking software?
- What is the pop-up and pop-under ad tag?
- What is the serving code or ad tag?
- What is WMODE for SWF ads? How can I change it?
- Where is the publisher-side file for iframe busting?
- Why doesn't the provided HTML serving code work?
Cannot find an answer for your question? Ask our Customer Care team
Related
- What are custom ad serving settings and variables?
"These are additional settings available to the serving code for advanced functionality. Custom Parameters You can enter one of the ..."
- Ad Tag and Serving Code
"Rotating Multiple Ads or Serving One Specific Ad You can choose between two types of rotation: rotate multiple ads within ..."
- Destination URL or Click URL
"The destination URL (also called "click URL", or "landing page URL"), is the website address that a visitor goes to ..."
- How can I support click tracking for external ad servers?
"This feature is used when you send AdSpeed's ad tag to another ad server and the other ad server also ..."
- Video Ad Serving
"AdSpeed's Video Ad Server uses the IAB standard for video advertising known as VAST (Video Ad Serving Template) so video ..."