Reads and stores various marketing parameters in Accounts Client Store. Super Important Thing for Marketing Team™. Only 3.1kB gzipped.
npm install --save @livechat/store-metrics
Library exposes only one function that saves source attribution and Partner Program affiliation params based on document.location
and document.referrer
. Make sure to fire it as early as possible, before redirects etc.
import storeMetrics from "@livechat/store-metrics";
storeMetrics();
For websites without module bundler/resolver you can use self-executing version of store-metrics. You can load it directly from our CDN:
<script src="https://cdn.livechat-static.com/metrics/store-metrics.min.js" async></script>
And that's it.
npm install
npm run test:watch
npm run build
Make sure it is already built. Then run:
http-server -p 8000
It requires http-server to be installed. Go to http://localhost:8000/example.html?param1=value1¶m2=value2
to test how params are handled.
- Extending store-metrics with tracking Partner Program landing pages
- Resetting partner_id if param not found in url
- Enabling debug mode for all environments (temporary for testing, to be removed later)
- Regexes for Marketplace in whitelisted urls
- Debug mode extended for urls containing
development
keyword
- Fixed regexes for whitelisted urls
- Debug mode for labs/staging environments
- Resetting partner_id
- Storage mechanism changed from cookies to cross-domain localStorage, to support multi-product Global Accounts
- Because there is no 'session' concpet in localStorage, default TTL is set to 2 weeks
- IE no longer supported
- URL API polyfill
- All cookies are now set with SameSite='none' and Secure attributes (see: https://www.chromestatus.com/feature/5633521622188032)
- ShareASale click ID first-party cookie (see: http://shareasale.com/itp/lead.htm#_Toc522268050)
- Return params which were saved while executing
- Referrer for internal redirects is no longer stored
- Self-executing version for browsers
- CDN deployment and website usage docs
- URL is not a constructor error
- Cookie domain for origins not starting with
www.
Initial release