1.1.1 • Published 3 years ago

react-user-activity-tracker v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

React user activity tracker

installation

npm i react-user-activity-tracker

basic example

import Tracker from 'react-user-activity-tracker';

function App() {
  const [id, setId] = useState(0);
  const changeId = (e) => {
    setId(e.target.value);
  } 
  return (
    <div className="App">
        <button onClick={changeId} value={0}>Button 0</button>
        <button onClick={changeId} value={1}>Button 1</button>
        <Tracker 
          trackerId={id} 
          onTrackerIdChange={ (id, value) => console.log(`${id} has been active for ${value} seconds. `)} 
          trackerSubmitInterval={10}
          onIntervalSubmit={ (id, value) => console.log(`${id} has been active for ${value} seconds. `)}
          timeout={1500} 
          />
    </div>
  )
}

props

trackerId

number, the identifier for the state being tracked.

onTrackerIdChange

function, fired when trackedId changes, get the trackerid and the time is has been active/viewed in seconds.

timeout

number, time in seconds when tracking should stop. Default 1800 seconds ( 30 minutes ).

debugOn

boolean, display a box with values.

trackerSubmitInterval

number, second passed between each onIntervalSubmit function

onIntervalSubmit

function, fired every (x : trackerSubmitInterval ) seconds

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago