Disable third party cookies using JavaScript

Vikas Dubey picture Vikas Dubey · Jun 15, 2018 · Viewed 8.7k times · Source

I am working to implement the new cookie policy compliance as per data protection rules for all companies operating in the EU according to which user has to be able to refuse/accept all but required cookies when he is using any website. In my client's website I can see the following third party cookies are getting stored.

  • _ga - my-site
  • _gid - my-site
  • __ncuid - .doubleclick.net
  • DSID - .doubleclick.net
  • IDE - .doubleclick.net
  • 1P_JAR - .google.be
  • NID - .google.be
  • CONSENT -.google.be
  • NID - .google.com
  • AID - .google.com
  • CONSENT - .google.com
  • 1P_JAR - .google.com
  • DV - www.google.be
  • OTZ - www.google.com
  • locale - my-site
  • anonymousUserId - my-site
  • SESSID - my-site
  • JSESSIONID - my-site
  • TS01c70fa1 - my-site

In the above mentioned list few cookies are Google Analytics cookies intiated by Google tag manager. I have handled them. But all the cookies with domain 'Google' and '.doubleclick.net' I have no control over them? And I am not able to understand how are they getting stored.

Answer

thomaux picture thomaux · Feb 11, 2019

Instead of blocking cookies that are being/were set, it's easier to not load i.e. the GTM script until after the user has consented to the cookie policy.