I want to share two very important functions that work on my javascript that you can use. credit goes to the link included for calling a cookie and setting a cookie value.

    //https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
    function setCookie(cnamecvalueexdays) {
        var d = new Date();
        d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
        var expires = "expires=" + d.toUTCString();
        document.cookie =
          cname + "=" + cvalue + "; SameSite=None; secure; " + expires;
      }
  
      function getCookie(cname) {
        var name = cname + "=";
        var ca = document.cookie.split(";");
        for (var i = 0i < ca.lengthi++) {
          var c = ca[i];
          while (c.charAt(0) == " "c = c.substring(1);
          if (c.indexOf(name) != -1return c.substring(name.lengthc.length);
        }
        return "";
      }