0.2.2 • Published 4 years ago

tracking-params v0.2.2

Weekly downloads
17
License
MIT
Repository
github
Last release
4 years ago

Tracking Params Build Status Bundle Size

Easily get and remove unwanted tracking parameters from URLs.

This project was inspired by neat-url, but includes more functionality by returning detailed info along with the cleaned URL.

Installation

npm install tracking-params

Usage

const { cleanUrl, getTrackingData } = require('tracking-params');

const url = 'https://example.com?ok=ok';
const dirtyUrl = url + '&utm_term=term';

console.log(cleanUrl(url));
// 'https://example.com?ok=ok'

console.log(cleanUrl(dirtyUrl));
// 'https://example.com?ok=ok'

console.log(getTrackingData(url));
// {
//   url: 'https://example.com?ok=ok',
//   isDirty: false,
//   trackingParams: [],
//   cleanUrl: 'https://example.com?ok=ok'
// }

console.log(getTrackingData(dirtyUrl));
// {
//   url: 'https://example.com?ok=ok&utm_term=term',
//   isDirty: true,
//   trackingParams: [
//     { key: 'utm_term', value: 'term' }
//   ],
//   cleanUrl: 'https://example.com?ok=ok'
// }
0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.3

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago