Using 2 'popups' before seeing my site - cookies help needed

Hi,
I currently use Blogger to host my website and I am trying to migrate to Hugo for various reasons, mainly Emacs being my main source for writing in general.
As my website has adult content, I have to craft two +18 Accept buttons to hide the content before the the visitor actually sees it.

Doing the two popups is actually easy but I am having trouble setting cookies (or localstorage but some browsers dont support it) to just remember that the user clicked the accept button so It doesnt show everytime the page is refreshed or everytime a link is clicked.

How can I manage to do that? What I got so far:
JS: /static/js/myscript.js (listed on configtoml)

function TermsAndConditions(){

days=30;
myDate = new Date();
myDate.setTime(myDate.getTime()+(days2460601000));

document.cookie = ‘TermsAndConditions=Accepted; expires=’ + myDate.toGMTString();

}

function CheckCookies(){
if ($.cookie(“TermsAndConditions”) === “Accepted”)
{
var x = document.getElementById(“popact”);
x.style.display = “none”;
}
}

HTML:

<html lang="{{ .Site.LanguageCode }}">

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js"></script>
<div id="popact">
    
  <h1>Terms and Conditions</h1>
    <p>Example Content</p>  
  <span class="accept-button"><a href="#" onclick="TermsAndConditions(); CheckCookies();">Accept</a></span>

</div>


  <head>

I put the script tag there but also in the script.html (using the tranquilpeak-theme, it looks what I already have at blogger).
I am planning to have the CheckCookie in body OnLoad too.

Please shed some light. This is the last step to switch it. Also, this is important as by law I need to have at least one popup (I think). Hosting on Render is allowed only if I follow laws regulation.
I don’t if putting the tag nsfw in the html solves the issue.

I am afraid that your question is OT in this forum since we do not provide support for JS. Please have a look at the Requesting Help guidelines for future reference.

Thanks.