Anchor Ads
By default, Ezoic will show anchor ads if enabled in the dashboard under the EzoicAds tab.

Turning Off Anchor Ads
To turn the Anchor Ad off for a specific page, the ezstandalone.setEzoicAnchorAd
function can be used.
In order for this functionality to work, it must be called prior to ezstandalone.showAds()
.
<script >
window.ezstandalone = window.ezstandalone || {};
ezstandalone.cmd = ezstandalone.cmd || [];
ezstandalone.cmd.push(function() {
ezstandalone.setEzoicAnchorAd(false);
ezstandalone.showAds(101, 102, 103);
});
</script>
Checking If Anchor Ad Was Closed
To see if the Anchor Ad has been closed for a user's session, use the hasAnchorAdBeenClosed
function.
Below is an example of using the function to determine whether to keep showing the Anchor Ad
<script >
window.ezstandalone = window.ezstandalone || {};
ezstandalone.cmd = ezstandalone.cmd || [];
ezstandalone.cmd.push(function() {
let anchorHasBeenClosed = ezstandalone.hasAnchorAdBeenClosed();
ezstandalone.setEzoicAnchorAd(anchorHasBeenClosed);
ezstandalone.showAds(101, 102, 103);
});
</script>
Configurable Options
There are configurable options available in EzoicAds that can be used to customize the behavior of the ad library. These options can be set using the ezstandalone.config()
function.
Setting Configuration Options
To set configuration options, use the following syntax:
ezstandalone.cmd.push(function() {
ezstandalone.config({
// Configuration options go here
});
});
Place this code after the EzoicAds header script, but before calling ezstandalone.enable()
or ezstandalone.showAds()
.
Available Options
Option |
Type |
Default |
Description |
limitCookies |
Boolean |
false |
Enables more precise control over cookie usage on your site. |
anchorAdPosition |
String |
bottom |
Change the position of the anchor ad to be at the top or bottom of the page. |
When enabled, the Limit Cookies feature ensures that only essential cookies required by Ezoic are included by default. This provides greater control over user privacy and helps with compliance to various data protection regulations.
To enable Limit Cookies:
ezstandalone.cmd.push(function() {
ezstandalone.config({ limitCookies: true });
});
Anchor Ad Position
Allows you to change the position of the Anchor Ad to be at the top or bottom of the page. Acceptable values are 'top' or 'bottom'. The Anchor Ad will be located at the bottom of the page by default.
For example to set the anchor ad position to be at the top of the page:
ezstandalone.cmd.push(function() {
ezstandalone.config({ anchorAdPosition: "top" });
});
More options will be added in the future. Please check back for updates.
Tracking Data
If you would like to track data even on pages that are not showing ads you can include the script below. This is specifically helpful in the starting stages of testing when you are not ready to show ads yet.
<script src="//ezoicanalytics.com/analytics.js"></script>
New Features (Beta)
These are new features that are available to be implemented but are still in Beta and may change before being fully released.
ShowAds Advanced Usage
The advanced implementation provides additional functionality by accepting an array of objects. Each object can include the following attributes:
- id (required): The unique identifier of the placeholder where the ad should be shown.
- required (optional, boolean): A flag indicating whether the ad must be displayed. If set to `true`, the system will force an ad to be shown in the specified placeholder, even if it would not normally be displayed.
- sizes (optional, string or array of strings): Specifies the allowed sizes for the ad in the format `'{width}x{height}'`. You can provide a single size as a string or multiple sizes as an array of strings. This allows you to control the dimensions of the ad that will be displayed.
Example Implementation
<script>
var placeholders = [
{ id: 103, required: true, sizes: ['336x280', '126x126'] },
{ id: 104, sizes: '1000x450' },
{ id: 105, required: true },
];
ezstandalone.showAds(placeholders);
</script>
In this example:
-
Placeholder 103:
- An ad will always be displayed in placeholder `103`.
- The allowed sizes for the ad are `336x280` and `126x126`.
-
Placeholder 104:
- An ad will be displayed in placeholder `104` if Ezoic decides this ad should be shown.
- The allowed size for the ad is `1000x450`.
-
Placeholder 105:
- An ad will always be displayed in placeholder `105`.
- No specific sizes are provided, so Ezoic will decide the best size for this placeholder.
Notes
- Specificity of Ad Sizes: The ad sizes specified in the `sizes` attribute are treated as specific requests. Ezoic will attempt to find the best possible ad that fits the given size. If an exact match is not available, the system will choose the closest available size that can best fit within the specified dimensions.
- If the `required` attribute is set to `true`, Ezoic will prioritize showing the ad in that placeholder, ensuring it is displayed even if other conditions might normally prevent it.
- If `sizes` are specified, the ad will only be displayed if an ad of the specified sizes is available. If the `sizes` attribute is omitted or left empty, Ezoic will use its default behavior to determine the ad size.
Use Cases
- Guaranteed Ad Placement: Use the `required` attribute to ensure that ads are shown in critical placeholders, regardless of other conditions.
- Size-Specific Ads: Use the `sizes` attribute to control the dimensions of the ads being displayed. This is particularly useful for responsive designs or specific layout requirements where certain sizes are more effective.
This advanced method offers flexibility and control over ad placement, making it suitable for scenarios where more than just the placeholder ID is needed to dictate ad behavior.
RefreshAds
refreshAds
is a new function in ezstandalone that allows for refreshing the ad for specific placeholders. This can be used if you would specifically like to refresh an ad for a viewer at a specific time. Below is an example of the function being used.
<script>
ezstandalone.cmd.push(function() {
ezstandalone.refreshAds(101, 102)
});
</script>