utm-parameters-toolset
v0.1.3
Published
Detect Utm parameters in url and store them to cookie. When needed, read them from cookie.
Maintainers
Readme
Utm Parameter to cookies
Read utm parameters from the url and store them in a cookie.
So that you can read them on a different subdomain....
Have fun!
Install
npm install utm-parameters-toolset --save
OR
yarn add utm-parameters-toolsetUse
import { Utm } from 'utm-parameters-toolset'
// create utm instance (set domain for allowed domains / subdomain)
const utm = new Utm({
domain: '.yourdomain.com', // support subdomain
expires: 365,
})
utm.store() // simply store everything from window.location to cookies
utm.get() // get everything from cookies as object
utm.clear() // clear storageLicense
MIT
Inspired by https://github.com/szymansd/utm-params/blob/master/index.js
