Hybrid Integration accounts for more complex sites that have a mix of static and dynamic content, allowing them to make use of all of Ezoic's features (e.g. Site Speed, SEO), while using the client-side code snippet to call for ads.
All site builds are able to benefit from this method integration, however sites that do not utilize dynamic content and / or do not wish to make changes to their DNS have the option to use JavaScript (Standalone) Integration https://support.ezoic.com/kb/article/javascript-standalone-integration instead. Sites that do utilize dynamic content and do not wish to make changes to their DNS can also integrate with Ezoic via this method instead, however additional configuration may be required. See https://support.ezoic.com/kb/article/my-content-loads-or-changes-dynamically-can-i-still-use-ezoic for further instructions.
Prerequisites
Make sure placeholders are created via the dashboard. See this 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.
<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:
<body>
<div id="ezoic-pub-ad-placeholder-103">
</div>
<!-- Content -->
<div id="ezoic-pub-ad-placeholder-104">
</div>
</body>
Calling For Ads
Once the placeholders have been added to the HTML, call for the Ezoic ad code by using ezstandalone.displayMore()
.
<script type="text/javascript">
window.ezstandalone = window.ezstandalone || {};
ezstandalone.cmd = ezstandalone.cmd || [];
ezstandalone.cmd.push(function() {
ezstandalone.showAds(103, 104);
});
</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:
<script type="text/javascript">
ezstandalone.cmd = ezstandalone.cmd || [];
ezstandalone.cmd.push(function() {
if(ezstandalone.isEzoicUser()) {
ezstandalone.showAds(100,101);
} else {
// Normal ad code execution
Advanced
EzoicAds provides advanced features that allow publishers to fine-tune the behavior of the ad library. These features can be used to customize the behavior of the ad library to better suit the needs of your site. See here for further instructions: https://docs.ezoic.com/docs/ezoicads/advanced/