General documentation for Content Lockers by Nuwara Labs

1 min read

This documentation covers the methods for integrating content lockers with Rewarded Ads on your website.
If you have any questions or uncertainties, please contact your account manager — they'll be happy to assist you.

STEP 1: Include script
Insert following script into the head of your html file:

<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script type="module" src="https://www.nuload.net/YOURDOMAIN_XY/ad.js"></script>

Before implementing both scripts in the header, check whether gpt.js has already been included by a previous GPT integration.
If it has, there's no need to add it again. In that case, include only the second script.

STEP 2: Add the class nu-reward to the element that should trigger the AD (content locker).

Button example: <button type="button" id="calculate_button" class="nu-reward">Calculate</button>
Href Example: <a class="nu-reward" style="cursor: pointer;"></a>

Custom event documentation


This documentation provides step by step instructions on how to implement custom event to start locker ad.


Custom event
To start locker AD using custom event, you need to dispatch a custom event with the name endAdEvent .

window.dispatchEvent(new CustomEvent('endAdEvent', { detail: { callback: () => {
alert('Ad ended');
} } }));


Function breakdown
This line dispatches the custom event with the name endAdEvent

window.dispatchEvent(new CustomEvent('endAdEvent', { detail: { callback: () => { alert('Ad ended'); } } }));

detail - This is the data that is passed to the event.
callback - This is the function that is called once user stops wathing the ad or when the ad is not available. You can pass in any function instead of alert('Ad ended'); .