github nytimes/react-tracking v2.0.0

latest releases: v9.3.2, v9.3.1, v9.3.0...
7 years ago

New Features

  • Deep-merge tracking data (#14) We now do a deep-merge of the tracking data. Previously we were doing a shallow-merge which meant that tracking data that shared a subkey would "lose" to the deepest version.
  • Exporting TrackingPropTypes (#18) you can now import the PropTypes definition for the tracking context object, if needed.
  • options.dispatchOnMount (#16) The "auto-dispatch" behavior is now opt-in. See Breaking Changes below for more info.

Breaking Changes

We no longer "auto-dispatch" when seeing tracking data like { page: 'FooPage' }. Instead you can opt-in to auto-dispatching by passing in options.dispatchOnMount, which will dispatch the tracking data when the component mounts. Like so:

@track({ page: 'FooPage' }, { dispatchOnMount: true })
export default class FooPage extends Component { ... }

This also means the previous behavior of automatically including { event: 'pageDataReady' } is no longer the case, and if this needs to be part of your tracking data you will have to manually include it where necessary.

See the README for more info.

Don't miss a new react-tracking release

NewReleases is sending notifications on new releases.