3

What are the available libs / tools to monitor user behavior in a react webapp?

I working with an advanced web system and have come to a point where it is important to collect data on user behavior on specific parts of the webapp. Example I would like to track how much time each user spend on the profile time the fist time they visit it. I would also like to log this in my database so I can do statistics and compare previous statistic.

Tool must:

  • Work inside a react app.
  • Be able to track time from component is visible until it is not visible.
  • Track time spend on a single page.
  • Be a independent standalone tool, no third party cloud jazz.

I'm not looking for:

  • google analytics.
  • tools that show where users clicked
  • tools that request user feedback
  • cookie tools

1 Answer 1

2

About two years later we found this library https://www.npmjs.com/package/timeme which does almost exactly the described needs.

We use it in react like this:

const TimeMe = require('timeme.js');

getInitialState () {
  return {
    entryTime: new Date()
  };
},

componentDidMount () {
  window.addEventListener('beforeunload', this.loggingInteraction);
  TimeMe.startTimer(pageId);
},

async loggingInteraction () {
  TimeMe.stopTimer(pageId);
  const activeTimeOnPage = TimeMe.getTimeOnPageInSeconds(pageId) * 1000;
  TimeMe.resetRecordedPageTime(pageId);
  const totalTimeOnPage = T.millisecondsBetween(this.state.entryTime, T.now());
  // http send time on page request
},

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.