Advanced Ads Pro lets you 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 plugin in WordPress
I’d expect most users who found this article already know why they are looking for an ad server. Still, here are a few use cases.
- Manage the same code in one place (the ad server) and use it on 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, the ad server plugin for WordPress
- 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.,
HTTPS
is 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.
Direct URL
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 the 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 width
and 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 you get the same view that other visitors will see.
Load the ad with JavaScript
The JavaScript method can be used for ads with dynamic sizes. It is also a good option for experienced developers who might want to modify the behavior of the ad insertion and code.
Our example code needs jQuery on the target website. You can find a plain JavaScript snippet here.
Limitations of the WordPress ad server
The ad server solution helps in situations where the features and performance of a dedicated ad server are not needed. The setup does not work with all the other features 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 run through admin-ajax.php
. Experienced developers can try the AJAX Optimizer to disable certain plugins for AJAX calls to improve performance. If the performance of the ad server is the key to your project, 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.
Due to the nature of the ad server placement, the tracking automatically uses the database method.
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 ad refresh
- ad labels
- tracking of impressions and clicks
- disable ads after a maximum number of impressions and ad clicks
Advanced Ads delivers ads without the placement container when used as an ad server. 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 also need to be included in the ad code, 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. Google 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.
FAQ
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-head
, advanced-ads-pro-ad-server-template-after-opening-body
, advanced-ads-pro-ad-server-template-before-closing-body
. Please find further instructions in the plugin’s source code.
The iframe or JavaScript codes you see in the placement options are just suggestions for implementing the code. You can adjust them if you know what you are doing.
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 hosting and managing the ads must run WordPress and Advanced Ads. The website that displays the ads does not need to run on WordPress or use the plugins.
Ads 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.
Troubleshooting
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 Width visitor conditions.
- If the ad still doesn’t show up, 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 any errors are given. This is often the case if the ad code is broken.
- If the ad appears under the Direct URL but not on the target site, 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.