Dynamic Script

The dynamic monetisation script is Neuwo's intelligent ad placement library. It builds placements from configurations injected into the script, and Neuwo tweaks those values remotely: the number of banners, where they go and how they behave are all adjusted without you touching the page again.

Dynamic scripts are far more efficient than static tags, because only one script load is needed. Once loaded, the script creates as many configured ad placements as it has been told to.

Placement identification

Placement locations are identified by the configurations embedded in each script. The locations are simply CSS selectors describing which elements should have ads created on or near them. One script selects many elements, and each selected element gets a placement.

For example, the selector .content p tells the script that every <p> tag inside the .content element is a candidate for ad creation. Other rules configure the frequency and the maximum number of banners.

Important

Changing the theme or layout of a site can stop placements being created, depending on how large the change is and what the structure looks like afterwards. Tell Neuwo immediately if this has happened, though notice beforehand is better: contact Neuwo or email adops@neuwo.ai.

Script location and injection

It is best to put the dynamic script in the <head> block. Some documentation online recommends against this, but it is fine here because of the async flag, which stops the script blocking the page. Even if Neuwo's services became intermittently unavailable there would be no ill effect on your pages beyond the placements not being created.

If the head block is genuinely not possible, near the bottom of the <body> is fine.

Injection through an ad server

It is not recommended to inject this script using Google Ad Manager or any other loader or ad server. That said, if there is no alternative, the dynamic script can be injected through an ad server as long as:

Injection is done by writing the script from a 1x1 ad server placement into the top frame of the page, with something like the following, which Neuwo provides:

<!-- Begin Neuwo (ad server) -->
<script type="text/javascript">
(function(s, w) {
  s.setAttribute("async", "async");
  s.setAttribute("type", "text/javascript");
  s.setAttribute("src", "//ads.neuwo.ai/loader/neuwo-loader.js?site=SITEID");
  w.document.body.appendChild(s);
})(window.top.document.createElement("script"), window.top);
</script>
<!-- End Neuwo (ad server) -->

SITEID is issued by Neuwo along with the tag itself. Note the call to w.document.body.appendChild(s), which is what writes the dynamic script into the top frame's <body>.

Configuration

The dynamic script is configured by Neuwo and can be set up to create a variety of placement opportunities under many different configurations. Once it has been deployed to a site there is usually nothing further for the publisher to implement. Additional units or alternate configurations can be requested from Neuwo without deploying any new tags.

In this way Neuwo works like a managed ad server, without the templates.

Compatibility

The dynamic script works in the latest versions of Chrome, Firefox, Edge and Safari, and most of its base functionality works on Internet Explorer 10 and above.

It is also compatible with current mobile browsers such as Mobile Safari and Chrome for mobile. Opera Mini is not supported, and the script is not guaranteed to work in embedded browsers.