Hybrid Option

For more complex sites that have a mix of static and dynamic content, and want to make use of all of Ezoic's features, we have our Hybrid Integration.

Hybrid Integration

Hybrid Integration is when a site integrates through nameservers or CloudFlare, while using the client-side code snippet to call for ads. The benefit of the hybrid integration is that it enables Ezoic's other products (e.g. Site Speed, SEO, Video, and many more) with the ability to load ads dynamically.

Prerequisites

Make sure placeholders are created via the dashboard. See article to learn more about placeholders and how to create them.

Load the code library by adding this script to the <head> of the page. Some Ezoic features require the HTML to exist statically rather than loaded via javascript.

1<script async src="https://www.ezojs.com/ezoic/sa.min.js"></script>

Adding Placeholders dynamically

To add a placeholder to the page create a div element of where the ad should be. The element's id attribute should be the ID of the placeholder with prefix ezoic-pub-ad-placeholder-.

For example, to add placeholders with the id 103 and 104, the HTML would look similar to this.

1<body>
2    <div id="ezoic-pub-ad-placeholder-103">
3    </div>
4    <!-- Content -->
5    <div id="ezoic-pub-ad-placeholder-104">
6    </div>
7</body>

Calling For Ads

Once the placeholders have been added to the HTML, call for the Ezoic ad code by using ezstandalone.displayMore().

1<script type="text/javascript">
2    window.ezstandalone = window.ezstandalone || {};
3    ezstandalone.cmd = ezstandalone.cmd || [];
4    ezstandalone.cmd.push(function() {
5        ezstandalone.displayMore(103, 104);
6    });
7</script>

Exceptions

For integrated sites without static placeholders that want to load all placeholders dynamically using our client-side ad setup, please use the following guide instead: Getting Started With EzoicAds.

Static placeholders are placeholders which are added to the html when passing through our proxy, rather than being added via javascript

Splitting Traffic

Splitting traffic relies on the settings in Ezoic dashboard

Similar to splitting traffic on a site using the client-side code snippet option, you can add the same function without passing any parameters.

 1<script type="text/javascript">
 2    ezstandalone.cmd = ezstandalone.cmd || [];
 3    ezstandalone.cmd.push(function() {
 4        if(ezstandalone.isEzoicUser()) {
 5            ezstandalone.showAds(100,101);
 6        } else {
 7            // Normal ad code execution
 8        }
 9    });
10</script>