0.1.3 • Published 4 years ago

utm-parameters-toolset v0.1.3

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

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-toolset

Use

  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 storage

License

MIT

Inspired by https://github.com/szymansd/utm-params/blob/master/index.js