Ezoic is a rather large AdSense partner and ad-optimization service, so users ask us regularly 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 that this tutorial might be outdated at one point. If you notice that any given information is not working anymore, please let me know through this page.

Setup for Ezoic in WordPress

There is one fundamental difference between Ezoic and ad networks: you are not just adding some ad tags and load them with the rest of your site. Instead, you place ad placeholders while Ezoic might or might not fill when optimizing your ad setup.

Ezoic asks you to route your traffic through their servers. This modification allows them to test ad positions and styles and improve your page speed and dynamically add other features that you can enable in your account.

Routing the traffic might not be an option for everyone since you’d depend on their servers. I have also seen some code being mixed up (see an example below). In general, smaller sites without dedicated WordPress hosting might benefit a lot from their additional offers.

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 --> </div> <!-- End Ezoic - above definition - under_second_paragraph -->
Code language: HTML, XML (xml)

The line in the middle is 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 also to use ads of different types (e.g., AdSense, image ads) with Ezoic and Advanced Ads combined.

Note: You need to wrap each ad on your site 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 as many placements as possible. More placeholders don’t mean more ads. They are only filling those that seem most beneficial to monetize a given page impression. You can also choose whether to focus more on UX, revenue, or a balance between both.

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

<!-- Ezoic - under_page_title - under_page_title --> <div id="ezoic-pub-ad-placeholder-105"> </div> <!-- End Ezoic - under_page_title - under_page_title -->
Code language: HTML, XML (xml)

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 use of the ad’s shortcode or our placements to place these ads manually or automatically on your site.

Ezoic, Caching and Cache-busting

Since Ezoic determines the ads for each user before the page loads, the cache-busting feature in Advanced Ads Pro will not work.

We designed our cache-busting to display user-specific ads on cached websites. It, therefore, needs to be loaded in the user’s browser to work correctly. 

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 many caching and page speed optimization features. See this page. You can use their free CDN and caching.

Ezoic Site Speed Accelerator

We have seen that the Speed Accelerator can delay the delivery of our scripts until all other resources are loaded on a site. In combination with our Cache Busting, this could delay the delivery of ads significantly. 

On the user’s site, we have seen a delay of 7 seconds. This delay is why we don’t recommend enabling the Site Speed Accelerator if you want to use cache busting.

Ezoic Site Speed Accelerator
The Site Speed Accelerator option in the Ezoic backend

Tracking

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. Ezoic asked us to refer users with the problem to their support so that they can resolve it.

Further resources