Popup: Adding “Fallback” Script

To sell traffic at your preferred price, you can set up a fallback for the popup script. This will allow you to connect a backup script from another ad network, which can be useful in several scenarios:

  • If we are unable to find a suitable ad.
  • If you wish to sell only a specific part of your traffic, such as mobile or desktop. Upon request, our manager can configure additional filters for you, such as GEO/device/browser.
  • If you want to sell your traffic at a particular price, and if the traffic costs less than your desired price, it will be redirected to a fallback script. Our managers can help you access this setting.

The first way of script integration

A standard link to the popup script is as follows:

<script src="//site.com/pu-placer.js?t=1570707368" data-ts="1570707368" data-domain='gecontentasap.com' data-cdn-domain='mobile-10.com/cdn' data-promo-cdn='site.com' data-pl-token='594079a44256bfe19011b8e113f6ae0f372555a6' data-type='up' data-freq='eyJwZXJpb2QiOjAsIm1pbkludGVydmFsIjo2MDB9' ></script>

Add the value below:

data-fallback-src="SRC_TO_SCRIPT"

SRC_TO_SCRIPT should be changed to the link of the script for Fallback. For this example, we will use a link that triggers an alert if no appropriate ads are available. Here is the link:

https://mobile-10.com/blog/wp-content/uploads/demo/fallback_test_demo.js 

Add the script to our link on popup:

data-fallback-src="https://mobile-10.com/blog/wp-content/uploads/demo/fallback_test_demo.js"

You will obtain this code:

<script src="//site.com/pu-placer.js?t=1570707368" data-ts="1570707368" data-domain='gecontentasap.com' data-cdn-domain='mobile-10.com/cdn' data-promo-cdn='example.com' data-pl-token='594079a44256bfe19011b8e113f6ae0f372555a6' data-type='up' data-freq='eyJwZXJpb2QiOjAsIm1pbkludGVydmFsIjo2MDB9' data-fallback-src="https://mobile-10.com/blog/wp-content/uploads/demo/fallback_test_demo.js"></script> 

To test this, we will use a text editor on W3Schools. Follow this link and add the script with Fallback after ending tag </style>.

Click the “Run” button and then click anywhere on the website.

If our system finds a suitable ad, it will open in a new tab.

If you wish to simulate a situation where a suitable ad cannot be found, add the element to the site URL:

&__emulate_no_ad=true

And you will receive a link:

https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_templates_food_blog&stacked=h&__emulate_no_ad=true

When you visit the new link, the previous script will be removed from the page. You will need to add it again after ending tag </style> and click the “Run” button.

After clicking on any place on the page, a message will appear.

The second way of script integration

The process for setting up a fallback for the popup script is similar to the previous method, but the script have been changed.

Start with the popup script link without any changes:

<script src="//site.com/pu-placer.js?t=1570707368" data-ts="1570707368" data-domain='gecontentasap.com' data-cdn-domain='mobile-10.com/cdn' data-promo-cdn='example.com' data-pl-token='594079a44256bfe19011b8e113f6ae0f372555a6' data-type='up' data-freq='eyJwZXJpb2QiOjAsIm1pbkludGVydmFsIjo2MDB9' ></script> 

Then, create a container where you can insert a script from another advertising network:

<script> window.onnoads_PLACE YOUR TOKEN FROM THE CODE HERE = function () { // PLACE YOUR CODE HERE } </script>

For testing purposes, we will replace “// PLACE YOUR CODE HERE” with a test script that displays a message indicating that no suitable ads were found:

 document.onclick = myClickHandler;        function myClickHandler() {
            alert("This is an example of a Fallback script. If you see this message, it means that our system didn’t find a suitable ad for your website during debug process. In real life, the script of another ad network will be triggered.");
        }

Combine the two scripts:

<script src="//site.com/pu-placer.js?t=1570707368" data-ts="1570707368" data-domain='gecontentasap.com' data-cdn-domain='mobile-10.com/cdn' data-promo-cdn='site.com' data-pl-token='594079a44256bfe19011b8e113f6ae0f372555a6' data-type='up' data-freq='eyJwZXJpb2QiOjAsIm1pbkludGVydmFsIjo2MDB9' ></script><script>
    window.onnoads_427679a44256bfe19011b8e113f6ae0f372555a6 = function () {
      document.onclick = myClickHandler;
        function myClickHandler() {
            alert("This is an example of a Fallback script. If you see this message, it means that our system didn’t find a suitable ad for your website during debug process. In real life, the script of another ad network will be triggered.");
        }
    }
  </script> 

Go to a test website and insert the code.

Press the “Run” button and click anywhere on the page. If our system finds a suitable ad, it will open in a new tab.

To simulate a situation where a suitable ad can’t be found, follow this link that includes a special parameter at the end. It will emulate a scenario where a suitable ad was not found or was blocked.

When you visit the new link, the previous script will be removed from the page. Add it again after the closing </style> tag and press the “Run” button. Click anywhere on the page to see the message appear.

Scroll to Top