Ad Server embed code examples

We provide the code snippets and content on this page without any guarantee or support. In most cases, these pages are created on requests or based on individual solutions sent to us by other users. After it was published, we are only reviewing the code and content when we are made aware of an issue. Please let us know if you find one.

Please only use the codes if you understand them and know how to add custom code to your WordPress site.

Advanced Ads Pro comes with an Ad Server for WordPress module.

The module comes with some basic injection codes that work in most cases. This page contains a few additional examples for ad server embed codes you can use for individual solutions users sent us.

Subscribe to our newsletter and get 2 add-ons for free!

* indicates required
Interests

Plain JavaScript

You might want to adjust the container ID server-01-box, especially if you have more than one ad server unit per page and the URL to the hosting site and placement in line 3.

<div id="server-01-box"></div>
<script>
fetch('//example.com/wp-admin/admin-ajax.php?action=aa-server-select&p=server-01')
  .then(function(response) {
    return response.text();
  })
  .then(function(body) {

var server_parser = new DOMParser();
var doc = server_parser.parseFromString( body, "text/html" );
var ad_container = doc.querySelector( 'div' );

    document.querySelector('#server-01-box').innerHTML = ad_container.innerHTML;
  });
</script>Code language: HTML, XML (xml)

Make it better

Increase your ad management skills without spending more time.
Join over 150,000 publishers and AdOpts increasing their ad revenue.