Zaraz and Wordpress cookies

Wordpress cookies carry a hash at the end, for example:

wordpress_logged_in_234jhkjbhdfs234d

Is there currently any way to match the cookie name and have a trigger blocking anyone logged into wordpress?

Unfortunately, there isn’t currently a way to use a cookie with a random string in its name.

Is there any planned implementation?

We can access specific cookies but not use a match against the whole cookie header?

It sounds like something we would like to support, but it isn’t currently on the roadmap as we didn’t see much interest in this feature yet.

Came here to ask the same question. A workaround would be to set a cookie yourself for logged in users and filter that.

But then how should someone with a Wordpress site use Zaraz google analytics? If I work on my website it will track me and completely falsify the analytics data.

you can create a trigger that matches your IP address ({{ system.device.ip }}) and then use it as a blocking trigger.

you can also give your self any other cookie, with a name and value you know, and then create a trigger based on that. you can then use it as a blocking trigger across your actions.

Add something like the following to your functions.php file, then set up Zaraz with a blocking rule for the is_admin cookie.

function setAdminCookie() { 
 if (current_user_can( 'update_core' )) {
 
if(!isset($_COOKIE['is_admin'])) {
 
// set a cookie for 1 year
setcookie('is_admin', "true", time()+31556926);
}
}
 
} 

add_action('init', 'setAdminCookie');

Cool idea. Thanks!