react-tracking icon indicating copy to clipboard operation
react-tracking copied to clipboard

Does react-tracking record impression?

Open khieu opened this issue 7 years ago • 1 comments

Hello,

I found react-tracking while looking for a solution to track clicks and impressions on a react web application. After some reading it looks like react-tracking handles click events. I want to ask if this library also help record impression events (a part/component of a page shows up on the screen) ? If the library does support that where can I find docs and example ?

Thank you so much for your help, really appreciate it !

khieu avatar Feb 09 '18 19:02 khieu

Yes, it's possible to use react-tracking for that, but it's left up to the app to fire off the tracking call since what defines an "impression" varies by app.

For example here's how we're doing impression tracking in one case. This makes use of react-visibility-sensor.

 onChange = isVisible => {
    if (isVisible) {
      this.props.tracking.trackEvent({
        event: 'impression',
      });

      this.setState({
        isVisible: true,
      });
    }
  };

  render() {
    return (
        <div>
          <VisibilitySensor
            scrollCheck
            scrollThrottle={100}
            intervalDelay={8000}
            onChange={this.onChange}
          />
          {this.state.isVisible && <FooComponent />}
        </div>
    );
  }

Hope that helps @khieu !

tizmagik avatar Feb 12 '18 17:02 tizmagik