https://github.com/moosend/website-tracking-js
By installing the Moosend JS Tracking library you are can track page views, product views, add to cart events and successful purchases.
https://github.com/moosend/website-tracking-js
automations javascript library tracking
Last synced: 2 months ago
JSON representation
By installing the Moosend JS Tracking library you are can track page views, product views, add to cart events and successful purchases.
- Host: GitHub
- URL: https://github.com/moosend/website-tracking-js
- Owner: moosend
- Created: 2017-06-07T18:00:22.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-06-19T14:02:59.000Z (12 months ago)
- Last Synced: 2025-03-21T17:56:33.865Z (3 months ago)
- Topics: automations, javascript, library, tracking
- Language: TypeScript
- Homepage: https://www.moosend.com/
- Size: 551 KB
- Stars: 2
- Watchers: 13
- Forks: 4
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#Global NPM packages
npm install [email protected] -g#Local NPM packages
npm install#NPM scripts
##Test
To run tests first compile sources with npm script
npm run build-watch-tests
or directly
tsc --noImplicitAny --outDir compiled/ --module commonjs test/*.test.ts --watch -t es5Then run tests
npm test##Demo
Demo consists of express server that serves to hosts. To run the demo you need
1. Add aliases to your hosts file
127.0.0.1 local.tracker.domain
127.0.0.1 local.client.domain
2. Bundle demo
npm run bundle-demo
3. Start demo server
npm run demo
4. Open browser at http://local.client.domain##Bundle
You can bundle js sources with npm script (that will produce dist/bundle.js)
npm run bundle
And you can bundle minified version (that will produce dist/bundle.min.js)
npm run bundle-min#Tracker API
moo.identify({ email: string, name?: string });
moo.track(action: string, { key: value });
moo.track(action: string, [{ key1: value1 }, { key2: value2 }]);moo.trackLogin(); // Will send LOGIN event with no context
moo.trackPageView(); // Will send PAGE_VIEW event with { url: string }// Events known on server side
// Will add item to order or increase the item count if already in order.
// If there is no STARTED order it will be created
moo.track('ADD_TO_ORDER', [{ itemCode: string }, { itemPrice: number }]);// Will remove currently STARTED order and insert COMPLETED order
moo.track('ORDER_COMPLETED')