Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does react-tracking record impression? #64

Open
khieu opened this issue Feb 9, 2018 · 1 comment
Open

Does react-tracking record impression? #64

khieu opened this issue Feb 9, 2018 · 1 comment
Labels

Comments

@khieu
Copy link

khieu commented Feb 9, 2018

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 !

@tizmagik
Copy link
Collaborator

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 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants