tracking-wallet

5.5.3 • Public • Published

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 jquery from the bundle. This may introduce some breaking changes in the projects which still rely on it.
  • support for Server Side Rendering (only uses window if it's available)
  • recovered agent identification functionality from v4
  • userRole tracking property automatically detected from session + cookies for one of the following values:
    • insured
    • agent
    • CW Internal User
    • CW test
  • Simplified alias logic. Only sends an alias call to Segment/Mixpanel if the userRole is NOT agent
  • NO event is sent to Segment if the userRole is CW Test (internal automated tests)

Migrate from v4 to v5

  • extractDataForm method 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.
  • init method deprecated and with it, the skipPageViewEvents option is deprecated too. Tracking-wallet will no longer emit a custom event for page views. For a page view event just use trackingWallet.page(). To start using the library, it is enough just to instantiate it:
import TrackingWallet from "tracking-wallet"
const tracker = new TrackingWallet();
tracker.track();
  • preserveUTMTags method deprecated. Just remove it's calls.
  • getUserId method deprecated. Use the following instead:
const id = trackingWallet.getAnalyticsUser().userId;

Migrate from v3 to v4

  • Remove calls to timeEvent method. 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.mixpanel from 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.analytics object is not ready before event is sent this event is stored in the queue and gets processed as soon as window.analytics is 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.

Readme

Keywords

none

Package Sidebar

Install

npm i tracking-wallet

Weekly Downloads

1

Version

5.5.3

License

MIT

Unpacked Size

124 kB

Total Files

26

Last publish

Collaborators

  • coverwallet-dev