Check if ignore cookie exists

Hi!

I am thinking of displaying a small padlock icon in the footer of my website when user has opted-out from Piwik statistics on my site.

I think this code should work:


<script type="text/javascript">
if (document.cookie.indexOf('piwik_ignore') != -1)
document.write('cookie is here');
else
document.write('cookie is not here');
</script>

The problem is that I am not sure how the ignore cookie is called. I thought it was piwik_ignore but it does not seem to work.

Any ideas? Is it even possible?

piwik_ignore is a “third party cookie” whereas reading cookies in javascript will read first party cookies only. Not sure how to make this work…

Ah, I see :frowning: I thought that if the cookie is from the same domain, it wouldn’t be treated as a third-party?

Nevertheless, thank you for replying! It wasn’t crucial but seemed like a nice touch :slight_smile: