...
AdEngine implementation in WordPress should be done directly in page codes for the best effectiveness. In the header
and body
, plugins are allowed; however, please notice the possible issues limitations listed below.
This integration guide applies if all ads are delivered by Snigel on a site with a simple page layout.
...
Replace **site.domain** with the actual site domain
Place the script at the very top of the header to ensure the best possible performance
If Google Analytics is used, place the AdEngine tag after the Google Analytics tag
Keep the correct order of the tags: first configuration and then loading of AdEngine
...
The page body needs to define div
elements to be filled with ads. They need to be placed where the ad should be displayed.
The div
elements should reserve the maximum width and height of the displayed ad to prevent Cumulative Layout Shift (CLS). If you are using ad labeling, reserve an additional 15px of height for the label. Please consult your account manager to get the exact ad sizes to reserve the proper space.
For each div
element name provided by your account manager, create tags like in the example:
Code Block |
---|
<div id="adngin-topleaderboard-0"></div> <div id="adngin-sidebar-0"></div> |
Note:
If
div
elements need to be reused, provide the information to your account manager.
...
Ensure that both codes for snigelPubConf and
loader.js
have the elements:data-cfasync="false"
async
Do not place scripts from Snigel in minify and cache plugins; if it can't be avoided, place them in exclude from minify and cache section.
Clear the cache - on both the server and CDN to have a real overview if get an accurate view of whether the implementation is correct and not causing any issues. It's often when When this step is missed; an issue is visible only , problems often only become apparent days or even weeks after implementation.
How to run an A/B test on WordPress
An A/B test on WordPress between AdEngine and AdSense, in this example, AdSense. An A/B test - in this case, 50%/50% requires a decision in the header on which script should be injected. The Body, to make the test easier, should contain both tags. This is just an example of how the A/B test 50/50 could be executed in such a situationfor example, requires a 50/50 traffic split. The decision on which script to inject should be made in the <header>
, while the <body>
can include both tags to simplify the test. This is just one approach for executing a 50/50 A/B test in this scenario.
Code Block | ||||
---|---|---|---|---|
| ||||
<script type="text/javascript"> function appendScript(url){ var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; script.setAttribute('async', 'async'); script.setAttribute('data-cfasync', 'false'); script.src = url; head.appendChild(script); } if (Math.random() >= 0.5) { appendScript('https://cdn.snigelweb.com/adengine/**domain.com**/loader.js'); } else { appendScript('https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'); } </script> |
...
It’s possible to condition how AdEngine will be called - using pubConfig. If a specific plugin gives the possibility to read the settings from the PHP level, it can allow steering the pubConfig snigelPubConf
elements.
For example, Plugin to manage Memberships - can have functions that allow checking membership levels. In this example, we want to show a limited amount of ads to users with specific membership levels and all ads to other members.
...