2.0.0 • Published 6 years ago

@madarche/donottrack v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

do-not-track

Accessing the user's preferences in terms of tracking can be slightly complicated. This module simplifies that.

Read the spec

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);