google analytics kirby code example
Example: google analytics kirby
Yes, like this:
<?php if(!cookie::exists('accepted')) {
cookie::set('accepted', 'true', 1440);
}
?>
This code checks if the cookie with the name “accepted” has already been set, if not, the cookie is set with the value “true” and a lifetime of 24 hours. For more options, see the docs.
You can check if the cookie has been set with
<?= cookie:get('accepted') ?>
Hope this helps.