Generate a cookie when user closes a webform block I have been tasked with having to setup a cookie that records when an anonymous user closes a newsletter signup webform block so that it no longer appears when reloading the current page or navigating to another page on a website.

Can anyone please advise if there is module that performs this function?

Or can someone please point me in the right direction in terms of the correct code snippet I can use to make this work?

Many thanks!
First you need to create a custom module and add javascript user identificator on your page with web form(to find out user anonymous or not)
Here is example

Next use jquery library and do the next thing:

// its just an example you need to put your #id or .class
$("#subform_close").on('click', function() {
      if(Drupal.settings.user_js_uid == 0)
           {
              // set cookie for whatever you want
              $.cookie("dont_show_web_form", 1, { expires : 1 });
          }
})


and in your php code 
check for that cookie

$_COOKIE["dont_show_web_form"] 


and hide your webform.