Skip to content

Releases: nytimes/react-tracking

v5.5.3

19 Oct 03:38
Compare
Choose a tag to compare

Actually move core-js to peerDep this time πŸ˜„ #101

v5.5.2

19 Oct 03:25
Compare
Choose a tag to compare

core-js moved to peerDep (thanks @damassi in #99)

v5.5.1

17 Oct 01:48
Compare
Choose a tag to compare

Adds core-js dependency #98 thanks @damassi

v5.5.0 - Now on Babel 7

16 Oct 14:46
Compare
Choose a tag to compare

Thanks to @damassi in #94 react-tracking now uses Babel 7

6bf2c3a Upgrade to babel 7 (#94)
759879f Update deepmerge, fix vulns (#96)
698e18c Fix lint (#95)
59c45f1 (damassi/master) Update README.md
a4a74db Fix test as a result of enzyme upgrade
81feee0 Update deps
c922ca4 Update README.md (typo) (#90)

v5.4.1

28 Aug 17:19
Compare
Choose a tag to compare

Bug Fixes

Thanks to @schustafa , react-tracking default dispatch will no longer push empty objects {} to window.dataLayer[]

8b40759 don’t push empty event objects (#88)

v5.4.0 - Now supports Promises/Async methods

23 Aug 19:29
Compare
Choose a tag to compare

Thanks to @spencewood in #82 react-tracking now supports async functions (or functions that return a Promise)

  @track()
  async handleEvent() {
    return await asyncCall(); // returns a promise
  }

See the main README documentation for more details, including how to conditionally dispatch a tracking event only when the promise resolves and/or rejects.

v5.3.0

22 Jun 18:52
Compare
Choose a tag to compare

Bumps some dependencies and bumped React peer dependency to support React 16 (thanks to @lszm in #72 )

v5.2.1 - Swap lodash.merge for deepmerge

24 Dec 15:19
Compare
Choose a tag to compare

v5.1.0 - Updating props now properly changes tracking data

17 Oct 19:01
Compare
Choose a tag to compare

Before #60 by @tanhauhau changes to props on intermediate components would not be updated when descendent components fired off tracking events. They would instead use the values that they were initialized with. They now properly update as their props update.

This is a bit of an edge case, but the usage feels natural enough that it makes sense to fix. It should not affect any current semantics or API. Take a look at the test cases added as part of the PR ( #60 ) for an example.

Much thanks to @tanhauhau for finding and fixing this bug! πŸŽ‰

v5.0.0 - State now available to decorated class methods

26 Sep 15:05
Compare
Choose a tag to compare

New Feature (Breaking Change)

Thanks to @mennenia in #45 πŸŽ‰

The signature of decorated class methods changes from:

(props, args) => { }

to:

(props, state, args) => { }

This is so that you can access Class runtime state information within the decorator, like so:

// Reminder, to decorate class methods, you need to decorate the class itself
@track()
export default class FooButton extends React.Component {

  // In this case the tracking data depends on
  // some unknown (until runtime) value (state and event)
  @track((props, state, [event]) => ({
    action: 'click',
    inModal: state.isModalShowing,
    label: event.currentTarget.title || event.currentTarget.textContent
  }))
  handleClick = (event) => {
    if (this.props.onClick) {
      this.props.onClick(event);
    }
  }

  render() {
    return (
      <button onClick={this.handleClick}>
        {this.props.children}
      </button>
    );
  }
}

NOTE: This was technically possible in previous versions, but required you to use the imperative this.props.tracking.trackEvent() API so that you had access to Class state, this.state. Now it's possible to keep the tracking logic declaratively in the decorator thanks to @mennenia ! πŸ’ͺ