Advanced Ads enables you to set up a simple ad server and display ads from your WordPress-site on another website. This could even be a website that is not using WordPress.
Table of Contents
Use cases for an ad server in WordPress
I’d expect most users who found this article to already know why they are looking for an ad server. Still, here are a few use cases.
- manage the same code on one place (the ad server) only and use it on many other related sites
- manage ads with Advanced Ads and place them on non-WordPress sites, e.g., an embedded forum
- manage content on a site to which you don’t have admin access
- use the ad server code as a fallback for an ad network that doesn’t have a 100% fill rate and keep control of what the fallback code delivers
- send the ad code to your affiliate partners and keep track of impressions and clicks on your end
- set up an ad store to sell ads through it then embed the ad server codes on your main site to keep the number of plugins to a minimum
Setting up the ad server
The Ad Server is a module included in Advanced Ads Pro. Follow these steps to display an ad on a different site.
- install Advanced Ads Pro
- navigate to Advanced Ads > Settings > Pro and enable the Ad Server module
- in most cases, you need to add the URL of the target site (without subdirectories or subdomains, the protocol, e.g.,
HTTPSis optional) in the Ad Server option
- create your ad or ad group, if you don’t have one, yet
- go to Advanced Ads > Placements and create a new Ad Server placement then assign the ad or ad group created in the previous step to the new placement
- click on show all options to see the code you can use to insert the ad on another site
Displaying an ad on another site
You can find the options to display an ad on the target site by clicking on the show all options link on the placement page.
The Direct URL allows experienced developers to load the ad with a custom method, like
cURL. You can also use it to test if the ad content works outside of your website by opening the URL in your browser.
Load the ad with an iframe
The iframe method is the most stable version to load the ad since it is not affected by code on the target URL. The downside is that the size will not adjust automatically on responsive sites.
You can find the code for the iframe tag in the placement options. You might want to adjust the values for
height to the size of your ads.
Note, that the iframe method could recognize that you are logged in to the ad hosting site and might show you the ad edit button or other tools meant for ad managers only. Please visit the target site from a browser where you aren’t logged in to the ad server or using incognito mode to ensure that you get the same view that other visitors will see.
Limitations of the WordPress ad server
The ad server solution is helping in situations where the features and performance of a dedicated ad server are not needed. The setup is not working with all the other features that Advanced Ads provides, including conditions, placement behavior like popups and sticky ads, or lazy loading. Such features would need to be implemented on the target site directly and cannot be delivered through the ad code.
The performance of the ad server depends on the size of your WordPress installation and your hosting package. The calls cun through
admin-ajax.php. Experienced developers can try the AJAX Optimizer to disable certain plugins for AJAX calls to improve the performance. If the performance of the ad server is the key for your project, then consider signing up for a dedicated third-party service.
The ad server code does not load any ads if the website where Advanced Ads is installed does use HTTP while the ad that should show the ads uses HTTPS.
Advanced Ads features that are expected to work with ads delivered through the ad server
- scheduling and expiration of ads
- ad rotation and ordered groups without the Refresh option
- ad labels
- tracking of impressions and clicks
- disable ads after a maximum number of impressions and clicks
When used as an ad server, Advanced Ads delivers ads without the placement container. For some ads, the Position or Size options might work, while for others, they might not.
General limitations of all ad servers apply here as well
- Ad codes that need header and body codes would require those codes to be included in a single ad unit code delivered through the ad server placement. If jQuery is needed in the ad code, it might need to be included in the ad code as well, especially when using the iframe method to embed the ad.
- Serving ads through an ad server might be against the terms of some ad networks. AdSense’s terms and conditions don’t allow it while other ad networks might. Please reach out to them and ask for instructions.
- While we have tested the setup with various modern browsers, we cannot guarantee or fix issues with older or rare browsers.
No, unless you or your web hosting are caching calls to
admin-ajax.php which is unlikely.
Developers can use the following hooks to extend the output of the ad server code:
advanced-ads-pro-ad-server-template-before-closing-body. Please find further instructions in the plugin’s source code.
The ad server module is disabled by default. If enabled, it can only load ads from your site but not write anything into it.
Yes. Impressions and clicks tracked through our Tracking add-on are recorded and can be used to create reports.
The site that hosts and manages the ads needs to run WordPress and Advanced Ads. The website that displays the ads does not need to run on WordPress or use the plugins.
Ad served through the ad server open in a new window, even if the settings in Advanced Ads are set to open them in the same window.
Try these steps when the ad server does not show the ad:
- disable any ad blocker.
- test the target site in a different browser making sure you are not logged in to the ad server
- open the Direct URL of the placement in a new tab
- if the ad shows up then the target URL is probably not added correctly under Advanced Ads > Settings > Pro > Ad Server
- disable all conditions for the ad, e.g., Device or Browser Size visitor conditions
- if the ad still doesn’t show up then open the source code view in your browser and check if the ad code contains the ad unit information. If that is the case then the ad server is working correctly
- open the browser console to see if there are any errors given. This is often the case if the ad code is broken
- if the ad shows up under the Direct URL but not on the target site then look into the browser console for any issues. See Sameorigin or CORS-Policy issues below for the most common problem.
Theoretically, the Enable this option to prevent direct access to the placement URL option can lead to the ad not showing on the target URL if that website does not send a referrer.