MegaRevenue - Advanced Features

Handle the situtation when there are no offers for a user

If you want to implement a custom action if there are no offers for the current user you need to to listen for the "megarevenue-no-offers" event, like in the following example:


      document.addEventListener('megarevenue-no-offers', event => {
        console.log(event.detail.id)
        // send traffic somewhere, you can implement your custom action here
        document.location.href = 'http://my-traffic-backup-url'
      }, false)
  
Here we send all such users to our traffic backup url, but you can implement your custom solution here, for example you can show a Content Locker or display specific content.
Once such a user comes up the event "megarevenue-no-offers" will be triggered on the document. In case you have multiple MegaRevenue attached to the page you can get id of the one that triggered the event from event.detail.id property.