Using the advads JavaScript library after jQuery is available

We provide the code snippets and content on this page without any guarantee or support. In most cases, these pages are created on requests or based on individual solutions sent to us by other users. After it was published, we are only reviewing the code and content when we are made aware of an issue. Please let us know if you find one.

Please only use the codes if you understand them and know how to add custom code to your WordPress site.

If you are using our advanced JavaScript functions to retrieve or store cookies on a website that loads the jQuery library in the footer, you might be interested in the following code snippets. The first part is an example of how to show the number of page impressions from the appropriate cookie. The second snippet shows how to use the set_cookie method to store information in a cookie.

Read cookie information after jQuery is available

<span class="advads_unprocessed"></span>
<script>
( function() {
    var el = document.getElementsByClassName('advads_unprocessed')[0];
    el.classList.remove( 'advads_unprocessed' );
    advanced_ads_ready( function() {
        el.innerHTML = advads.get_cookie( 'advanced_ads_page_impressions' );
    } );
} )();
</script>

Subscribe to our newsletter and get 2 add-ons for free!

* indicates required
Interests

Store cookie information after jQuery is available

<button type="button" class="advads_unprocessed">reset</button>
<script>
( function() {
    var el = document.getElementsByClassName('advads_unprocessed')[0];
    el.classList.remove( 'advads_unprocessed' );
    advanced_ads_ready( function() {
        el.onclick = function() {
            advads.set_cookie( 'advanced_ads_page_impressions', new Date().getTime(), null )
        }
    } );
}() );
</script>

Make it better

Increase your ad management skills without spending more time.
Join over 150,000 publishers and AdOpts increasing their ad revenue.