@livechat/store-metrics
v2.0.3
Published
This package reads, stores and forwards various marketing parameters based on url search params.
Downloads
701
Maintainers
Keywords
Readme
@livechat/store-metrics
This package reads, stores and forwards various marketing parameters based on url search params.
Installation
npm install --save @livechat/store-metricsUsage
Apps
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()Websites
⚠️ At the moment the package served is old and should be updated ⚠️
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.
Development
npm install
npm run devExample page should be available at: http://localhost:5173
Running Tests
Execute the test suite:
npm testPublishing
This package uses Semantic Versioning and supports both stable releases (e.g., 2.0.2) and beta releases (e.g., 2.0.0-beta.7).
- Update the version in
package.json.
For a stable release:
npm version patch # or minor, or majorFor a beta release:
npm version prerelease --preid=beta- Publish the package.
For a stable release:
npm publish --access publicFor a beta release (avoids setting it as latest):
npm publish --tag beta --access publicYou can also run tests in watch mode:
npm run test:watchBuild
npm run buildDebug mode
To enable debug mode, set a debug key to true in the sites localStorage. It will log all the params that are being saved.
