Features Ad Serving
Native Ad Serving
A native ad is different from a standard advertisement. It blends in with other contents on the page. Example: a sponsored link in between other organic links on your page, a promotional post in your blog or a thread in your forum, or text link ads in email newsletter. Additionally, you can use native ad serving to address ad blocking issues with third-party requests.How It Works
You can integrate our ad serving capability into your own product and application natively. Instead of pasting the HTML/JavaScript ad tag into your website, you can make a direct ad request to our ad serving API to fetch an ad. The result from the ad server is in XML or JSON format with the individual ad components: the ad ID, dimension, ad tag and tracking code.Your app can then extract and further process the XML/JSON result. You can display the ad in any custom way that is native and suitable for your interface or application. By displaying ads natively with server-to-server requests, you can work around ad blockers because there is no direct request from the user's browser to our ad servers.
Technical Integration
If the request is made from your server then the client's IP might need to be passed along for geo-targeting to work. Please contact us for more technical details when you are ready to test or integrate this ad serving method.If your site requires all externally-sourced SCRIPT tags to have a hash for Subresource Integrity, you can use a client-side JSON ad request to avoid enforcing a hash on a dynamic ad request. The result of each ad request from AdSpeed adserver is dynamic and not static. The reason is because it actually contains the ad chosen from the zone, which is different each time.
Sample Code - Client-side JSON
<div id="MyAdContainer"></div> <script type="text/javascript"> $(document).ready(function () { $.getJSON('https://g.adspeed.net/ad.php?do=json&zid=XXXX&oid=YYYY&wd=-1&ht=-1&target=_blank&cb='+Math.random(), function (j) { $('#MyAdContainer').append(j.AdServing.AdCode); $('#MyAdContainer').append(j.AdServing.TrackerCode); }); }); </script>For third-party ad tags that depend on document.write()
<div id="MyAdContainer"></div> <script src="https://g.adspeed.net/js/adspeed_jsonframe.js"></script> <script type="text/javascript"> $(document).ready(function(){ $.getJSON('https://g.adspeed.net/ad.php?do=json&zid=XXXX&oid=YYYY&wd=-1&ht=-1&target=_blank&cb='+Math.random(),function(j){ AdSpeed_json('MyAdContainer',j); }); }); </script>
Sample Code - Server-side XML/JSON
<?php /** * Fetch an ad from the adserver * @param string URL * @return string */ function requestAd($pURL) { $vCURL = curl_init($pURL); curl_setopt($vCURL,CURLOPT_USERAGENT,'AdSpeedNativeAdServer-Server2ServerRequester'); curl_setopt($vCURL,CURLOPT_RETURNTRANSFER,1); $vResult = curl_exec($vCURL); curl_close($vCURL); return $vResult; } // Example 1: JSON $vResult = requestAd('https://g.adspeed.net/ad.php?do=json&zid=XXXX&oid=YYY&wd=-1&ht=-1&target=_blank&cb='.time()); $vJSON = json_decode($vResult); echo("\n\n<h4>Request JSON from AdSpeed AdServer</h4>\n\n"); echo($vJSON->AdServing->AdCode); echo($vJSON->AdServing->TrackerCode); // Example 2: XML $vResult = requestAd('https://g.adspeed.net/ad.php?do=xml&zid=XXXX&oid=YYY&wd=-1&ht=-1&target=_blank&cb='.time()); $vXML = simplexml_load_string($vResult); echo("\n\n<h4>Request XML from AdSpeed AdServer</h4>\n\n"); echo((string)trim($vXML->AdCode)); // data w/in CDATA echo($vXML->TrackerCode->div->asXML()); ?>
Other Articles in Ad Serving
- Ad Formats and Ad Dimensions
- Ad Optimization
- Ad Tag and Serving Code
- Ad Targeting
- Ad Tracking
- Competitive & Companion Positioning
- Default and Secondary Zone
- Email Ad Serving
- Mobile Ad Serving
- Priority in Serving Frequency
- Roku Ad Serving
- Secure Ad Serving with SSL
- Text Link Ads
- Video Ad Serving
- VMAP Video Ad Serving
- Zone Targeting and Campaign Targeting
Cannot find an answer for your question? Ask our Customer Care team
Related
- Sample Code
"Please see the example below to access AdSpeed API. PHP <?php class MyApp { private $mEndPoint = 'https://api.adspeed.com/'; private $mKey ..."
- How can I avoid document.write warning in Chrome?
"If you see a warning about document.write in Google Chrome like the one below for the ad server's request, it ..."
- How can I defer ads until after the page has finished loading?
"Typically, content is loaded according to the components' order in the HTML source code. If you want visitors to see ..."
- Target Keywords
"By setting up keyword targeting for an ad, you can choose to show or hide this particular ad when the ..."
- How can I display an ad only when it is visible on screen?
"Typically, when you first load a web page, all ads are loaded simultaneously along with all other components and contents ..."