@madarche/donottrack
v2.0.0
Published
Module to check the value of the DNT header
Downloads
12
Maintainers
Readme
do-not-track
Accessing the user's preferences in terms of tracking can be slightly complicated. This module simplifies that.
Install
npm install --save donottrack
Usage
Browser:
import doNotTrack from 'donottrack';
// Returns true if the user does not want to be tracked, false otherwise,
// tracking allowed if nothing specified.
const dnt = doNotTrack();
// Returns true if the user does not want to be tracked, false otherwise,
// NO TRACKING allowed if nothing specified.
const dnt = doNotTrack(true);
Node.js:
const donottrack = require('donottrack').default;
// Returns true if the user does not want to be tracked, false otherwise,
// tracking allowed if nothing specified.
const dnt = doNotTrack(req.headers);
// Returns true if the user does not want to be tracked, false otherwise,
// NO TRACKING allowed if nothing specified.
const dnt = doNotTrack(req.headers, true);