tracking-wallet
v5.5.3
Published
Tracking wallet ======================== ## v5.5.1 - add the properties in camelCase to the events, keeping the old ones.
Downloads
11
Readme
Tracking wallet
v5.5.1
- add the properties in camelCase to the events, keeping the old ones.
v5.4.0
- added dynamic props to page method under TrackingWallet class
- each page view / Loaded a page event now can be customized with new properties by passing in argument
v5
- removes
jqueryfrom the bundle. This may introduce some breaking changes in the projects which still rely on it. - support for Server Side Rendering (only uses
windowif it's available) - recovered agent identification functionality from v4
userRoletracking property automatically detected from session + cookies for one of the following values:- insured
- agent
- CW Internal User
- CW test
- Simplified
aliaslogic. Only sends an alias call to Segment/Mixpanel if theuserRoleis NOTagent - NO event is sent to Segment if the
userRoleisCW Test(internal automated tests)
Migrate from v4 to v5
extractDataFormmethod deprecated. JQuery is removed from the library, tracking-wallet is no longer in charge of gathering the data from hidden inputs: each host project will provide the data for the event methods in their own way.initmethod deprecated and with it, theskipPageViewEventsoption is deprecated too. Tracking-wallet will no longer emit a custom event for page views. For a page view event just usetrackingWallet.page(). To start using the library, it is enough just to instantiate it:
import TrackingWallet from "tracking-wallet"
const tracker = new TrackingWallet();
tracker.track();preserveUTMTagsmethod deprecated. Just remove it's calls.getUserIdmethod deprecated. Use the following instead:
const id = trackingWallet.getAnalyticsUser().userId;Migrate from v3 to v4
- Remove calls to
timeEventmethod. The calls can stay but will fall back to an additional track event for the same event name ended in_TIME_EVENT - Remove all references to
window.mixpanelfrom the project
Usage
ES6 Module:
import TrackingWallet from 'tracking-wallet';
const trackingWallet = new TrackingWallet();
trackingWallet.identify('userId', { /* User traits */ });
trackingWallet.track({ /* Event */}, { /* Event options */});or use the bundled version:
<script type="text/javascript" src="<path>/dist/tracking-wallet.min.js"></script>
<script type="text/javascript">
var trackingWallet = new window.TrackingWallet();
trackingWallet.identify('userId', { /* User traits */ });
trackingWallet.track({ /* Event */}, { /* Event options */});
</script>- If
window.analyticsobject is not ready before event is sent this event is stored in the queue and gets processed as soon aswindow.analyticsis ready.
Developement
You don't need to run a separate script to bundle the minified version of the code. It will be done automatically and added to your commit when you make changes in the src directory.
