@madarche/donottrack

2.0.0 • Public • Published

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

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i @madarche/donottrack

    Weekly Downloads

    6

    Version

    2.0.0

    License

    MIT

    Last publish

    Collaborators

    • madarche