Read utm parameters from the url and store them in a cookie.
So that you can read them on a different subdomain....
Have fun!
npm install utm-parameters-toolset --save
OR
yarn add utm-parameters-toolset
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
MIT
Inspired by https://github.com/szymansd/utm-params/blob/master/index.js