export default function cookieBlocker() {
  window.document.cookie = '__adblocker=; expires=Thu,' + ' 01 Jan 1970 00:00:00 GMT; path=/';
  window.setNptTechAdblockerCookie = function setNptTechAdblockerCookie(adblocker) {
    const d = new Date();
    d.setTime(d.getTime() + 60 * 60 * 24 * 2 * 1000);
    window.document.cookie = `__adblocker=${adblocker ? 'true' : 'false'}; expires=${d.toUTCString()}; path=/`;
  };
  const script = window.document.createElement('script');
  script.setAttribute('async', true);
  script.setAttribute('src', '//www.npttech.com/advertising.js');
  script.setAttribute('onerror', 'setNptTechAdblockerCookie(true);');
  window.document.getElementsByTagName('head')[0].appendChild(script);
}