Ezoic is a rather large AdSense partner and ad-optimization service, so I am regularly asked how to integrate them into WordPress using Advanced Ads. This page gives an overview. I am linking to the Ezoic website for the information covering the setup on their end while focusing on how to bring those features to WordPress in more detail here.

I have seen Ezoic change technically over the years, so this tutorial might be outdated at one point. If you notice that any of the given information is not working anymore then please let me know through this page.

Setup for Ezoic in WordPress

There is one fundamental difference between Ezoic and other ad networks and providers: you are not just adding some ad tags and load them with the rest of your site. Instead, you place the tags and route your whole traffic through their servers. The ads are then added before the site reaches your users.

This technique allows Ezoic to get the best bit for the ad tags and also compete with other networks on the same page impression.

A downside is that you are depending on their servers and some browser-based features of ads might not work.

In order for Ezoic to optimize the ad combinations on your site, you will need to:

  • Use the Ezoic Ad Tester and wrap existing ads so that Ezoic can improve their revenue
  • Put multiple placeholders on your site to allow Ezoic to test different ad combinations in the best performing positions for each user

Wrapping your existing ads

To test your existing ads against Ezoic, you’d need to wrap them with a specific “placeholder” code. An example from their manual is this:

<!-- Ezoic - above definition - under_second_paragraph -->

<div id="ezoic-pub-ad-placeholder-100">

<!-- the existing ad code -->


<!-- End Ezoic - above definition - under_second_paragraph -->

The line in the middle is actually the ad code managed in WordPress, e.g., by Advanced Ads.

The technically best way to add this extra code before and after the ad is using the Plain Text & Code ad type. It works with all kinds of HTML.

Another option is using an intermediate ad:

  • create a new ad
  • use the Plain Text & Code type
  • enable the Shortcode option
  • add the Ezoic placeholder code and the shortcode of the ad like on the screenshot below
  • use this new ad instead of the other one, e.g., in a placement or a group
Ezoic ad on WordPress

This would allow you to also use ads of different types (e.g., AdSense, image ads) with Ezoic and Advanced Ads combined.

Note: Each ad on your site needs to be wrapped with a unique Ezoic placeholder.

Using Placeholders

Ezoic’s placeholders are a bit like our Placements. They define places where ads could potentially show up. Ezoic asks you to implement a lot (i.e., up to 15) of those placements on your site. They are only filling those that seem most beneficial for a page impression and not all of them.

The placeholder codes look like the wrapper codes from above, but without the ad between them.

<div id="ezoic-pub-ad-placeholder-100"></div>

Using and placing them with WordPress is very simple with Advanced Ads.

Just create a new ad with the Plain Text & Code ad type and put the placeholder code into the code field.

Now you can make use of the ad’s shortcode or our placements to place the Ezoic ads manually or automatically on your site.

Caching and Cache-busting in Advanced Ads Pro

Due to the fact that Ezoic determines the ads for each user before the page loads, the cache-busting feature in Advanced Ads Pro is not going to work.

Our cache-busting was designed to display user-specific ads on cached websites. It, therefore, needs to be loaded in the user’s browser to work properly. Since Ezoic already decides which ads it will deliver before the site reaches the browser, it won’t work if cache-busting is enabled. This also applies to Pro features that depend on cache-busting, like refreshing ad groups on the spot and lazy loading ads.

There is only one solution that we discussed with the Ezoic team: disable caching and cache-busting.

The good news is that Ezoic itself has a lot of caching and page speed optimization features. See this page. You can use their free CDN and caching.


We found out that some script optimization made by ezoic removes JavaScript needed for impression tracking. If this is happening, you can find the error advads_tracking_methods is not defined in the browser’s developer console. Please reach out to them for a solution.

Further resources