Skip to content

Releases: nytimes/react-tracking

v4.2.1

17 May 17:23
Compare
Choose a tag to compare

Bug Fix

#40 - Fixes the TrackingPropType export

v4.2.0 - TrackingPropType and TrackingContextType

17 May 16:46
Compare
Choose a tag to compare

In #39 we now export two different proptypes:

  • TrackingPropType (new) - This is a proptype you can use for decorated components.
  • TrackingContextType (renamed) - This is a context proptype you can use if you want to pick off context (this was previously named "TrackingPropType" which would be confusing with the new proptype mentioned above).

v4.1.0 - Available on npm

16 May 18:59
Compare
Choose a tag to compare

Same as v4.0.0 but now published to npm as react-tracking 🎉

v4.0.0 - New default dispatch() behavior

15 May 14:39
Compare
Choose a tag to compare

Breaking Change

In #35 the default dispatch behavior of emitting a CustomEvent has been removed in favor of pushing tracking objects to window.dataLayer[]. This is a good default for most pass that use Google Tag Manager for tracking.

If you had previously been relying on CustomEvent, you will need to now import that module into your project and define the call to CustomEvent as your new overriding dispatch() function on some top-level component. See the main README for details.

If you had previously been defining dispatch() on some top-level component, then this is not a breaking change from your perspective because any overriding dispatch function declaration will be used instead of the default behavior.

v3.0.0 - New `tracking` prop

08 May 19:55
Compare
Choose a tag to compare

New Feature

In #31 we now expose a single tracking prop that looks like:

{
  // tracking prop provided by @track()
  tracking: PropTypes.shape({
    // function to call to dispatch tracking events
    trackEvent: PropTypes.func,

    // function to call to grab contextual tracking data
    getTrackingData: PropTypes.func,
  })
}

This is so that you can grab the contextual tracking data if you need it by calling props.tracking.getTrackingData(). The previous props.trackEvent() is now props.tracking.trackEvent().

Breaking Changes

props.trackEvent() is now props.tracking.trackEvent()

v2.2.2

18 Apr 14:44
Compare
Choose a tag to compare

#30 - Now using prop-types module for React PropTypes

v2.2.1

11 Apr 21:39
Compare
Choose a tag to compare

Bug Fix

#29 Fixes a bug introduced in v2.2.0, where tracking events were dispatched from process() even when tracking events were dispatched in child handlers

v2.2.0 - New `process()` option

07 Apr 13:58
Compare
Choose a tag to compare

New Feature

options.process() ( #27 ) can now be defined to selectively dispatch a tracking event when any decorated component mounts, based on the tracking object for each component. This will help clean up the verbosity that's currently required to dispatch PageView events using dispatchOnMount() previously.

See the README for more details.

v2.1.1

15 Feb 22:15
Compare
Choose a tag to compare

Bug Fix

options.dispatchOnMount() will now merge in the context data for you.

v2.1.0

15 Feb 20:32
Compare
Choose a tag to compare

New Features

options.dispatchOnMount() as a function (#20) - You can now provide a function instead of just a boolean for dispatchOnMount. The function provided will be called with a single argument, all of the context tracking data in the app. You can chose to ignore this in order to dispatch exactly the object you want when the component you are decorating mounts (in componentDidMount()).

See the README for example usage.