Setting Up Ads
Connecting your site to Ezoic is a simple process that involves adding a few lines of code to your site. While waiting for Google Ad Manager approval, we recommend getting set up in a staging or dev environment to ensure your ad placements are setup properly and ad loading is confirmed.
This guide will walk you through the steps to implement EzoicAds on your site.
Step 1: Create Ad Placements
In order to implement EzoicAds, you will need to create ad placements on your site. These ad placements will be used to define the ad locations on your site where Ezoic ads will be displayed.
You can create ad placements in your Ezoic Dashboard, or you can work with your Ezoic Onboarding Specialist to create the ideal ad placements for your site.
Step 2: Add Header Scripts
Add the Ezoic Privacy Script and Header Script at the very top of the <head>
tag. Please ensure you load the privacy script before the header script.
Privacy Script:
1<script src="https://the.gatekeeperconsent.com/cmp.min.js" data-cfasync="false"></script>
Header Script:
1<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>
2<script>
3 window.ezstandalone = window.ezstandalone || {};
4 ezstandalone.cmd = ezstandalone.cmd || [];
5</script>
<head>
tag. If placing them in the head is
not feasible, the next best
option is to position them at the very top of the <body>
tag.
Step 3: Insert Ad Locations
This code will be called for each ad location. It is important to note that the 3-digit 101
ID represents a specific ad location, and each ad location will have a different 3-digit ID. Ad codes will be generated in your EzoicAds Dashboard.
Each ad location will have the following structure:
1<div id="ezoic-pub-ad-placeholder-101"></div>
2<script>
3 ezstandalone.cmd.push(function() {
4 ezstandalone.showAds(101)
5 });
6</script>
Insert this code for each ad location on your site.
Pages with multiple placeholders should ideally pass all of their placeholder IDs into a single showAds()
call. This will help to reduce the number of requests made
to the Ezoic server.
Example: ezstandalone.showAds(101, 102, 103, 104)
DO NOT add any styling to the actual placeholder div
.
Adding styles or reserving space for the ad may end with undesired results (e.g. if a placeholder is not chosen by our system, there may be empty space on the page).
ezstandalone.showAds()
without defining a placeholder value will call the function for every placeholder that exists on that page.
Setup Complete
Once you have completed these steps, you have successfully implemented EzoicAds on your site. If you have any questions or need assistance, please reach out to Ezoic's support team.