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>

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>