With the following method, you can easily send to WisePops some cookies values set on your website, as custom properties.

Helper to read cookies

First of all, we want to be able to read values inside cookies in Javascript. Various solutions exists, we will use the one described in this post:

function getCookieValue(a) {
    var b = document.cookie.match('(^|[^;]+)\\s*' + a + '\\s*=\\s*([^;]+)');
    return b ? b.pop() : '';
}

Map cookies to custom properties

You can now use the helper function to store the cookies values you are interested in as WisePops custom properties:

wisepops('properties', {
    cookie1: getCookieValue('cookie1'),
    cookie2: getCookieValue('cookie2'),
    cookie3: getCookieValue('cookie3')
});


With this snippet, we have read 3 different cookies, named cookie1 , cookie2  and cookie3 , and set their values into custom properties with the same name.

Place these two snippets just after the WisePops tracking code

You should end up with a script that looks like this:

<script type="text/javascript" data-cfasync="false">
    // WisePops tracking code
    (function(W,i,s,e,P,o,p){W['WisePopsObject']=P;W[P]=W[P]||function(){
        (W[P].q=W[P].q||[]).push(arguments)},W[P].l=1*new Date();o=i.createElement(s),
        p=i.getElementsByTagName(s)[0];o.async=1;o.src=e;p.parentNode.insertBefore(o,p)
    })(window,document,'script','//loader.wisepops.com/get-loader.js?v=1&site=XXXXXXXXXX','wisepops');

    // Set custom properties from cookies
    function getCookieValue(a) {
        var b = document.cookie.match('(^|[^;]+)\\s*' + a + '\\s*=\\s*([^;]+)');
        return b ? b.pop() : '';
    }
    wisepops('properties', {
        cookie1: getCookieValue('cookie1'),
        cookie2: getCookieValue('cookie2'),
        cookie3: getCookieValue('cookie3')
    });
</script>
Did this answer your question?