I am trying to set a cookie-value for somebody who visits my index-page with cookie.js like so:
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
<script>
var index_da = Cookies.get('sw_home_visit');
if (index_da < 1) {
Cookies.set('sw_home_visit', '1', {
expires: 365
});
console.log("nicht da")
} else {
console.log("da")
}
</script>
As I get printed "da" all the time in my console this can have several reasons I guess; is this then right or what do I need to correct?