How to load jquery cookie library for anonymous user
For available Jquery and Jquery cookie for anonymous user, it should add it on  theme libraries dependencies , as example if your theme name is themename  on themename.libraries.yml add 

  dependencies:
    - core/jquery.cookie