5

How can I set "do not track" when lunching chromium in puppeteer? Is it possible?

Is there any option in args to set as follows.

 puppeteer.launch({ args=['DO_NOT_TRACK']})

Tried many options listed in chromium switches, but could not find the one I need. By setting such option, I want to avoid google analytics track.

arslan
  • 2,034
  • 7
  • 34
  • 61

1 Answers1

7

The way to do it is as follows.

const page = await browser.newPage();
page.setExtraHTTPHeaders({ DNT: "1" });
arslan
  • 2,034
  • 7
  • 34
  • 61