Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bradoyler/event-timer
Track how long "real users" are waiting... (ie. VideoStart, AdStart etc.)
https://github.com/bradoyler/event-timer
Last synced: 11 days ago
JSON representation
Track how long "real users" are waiting... (ie. VideoStart, AdStart etc.)
- Host: GitHub
- URL: https://github.com/bradoyler/event-timer
- Owner: bradoyler
- Created: 2015-09-16T14:49:19.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-21T17:26:05.000Z (about 9 years ago)
- Last Synced: 2024-10-11T01:14:31.961Z (about 1 month ago)
- Language: JavaScript
- Homepage: http://bradoyler.github.io/event-timer/examples/
- Size: 145 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# event-timer
Simple library to track timings of events (for Real User Monitoring) in Google Analytics (works with DTM & GA events)## USAGE:
### Setup timer
```js
EVENT_TIMER.init('timer_a', function (timings) {
console.log('## timer started', timings);
// using GA events
// ga('send', 'event', timings.timerName, 'init', 'na');
// OR using DTM w/ appropriate data elements
// _satellite.track('TimerInit');
});
```
*output:*
```
[object Object] {
duration: "",
event: "",
startTS: 1442416197124,
timerName: "timer_a"
}
```### Mark the timing
*(of desired event)*
```js
setTimeout(function(){
// or put this inside a custom event handler
EVENT_TIMER.mark('video_start', function(timings){
console.log('### timings', timings);
// ga('send', 'event', timings.timerName, timings.event, timings.duration);
});
}, 2200);
```*output*
```
[object Object] {
duration: "0-4s",
durationMs: 2202,
durationSeconds: 2,
event: "video_start",
startTS: 1442416094430,
timerName: "timer_a",
triggered: true
}
```## Run locally (mac)
```sh
python -m SimpleHTTPServer
```Goto: `http://localhost:8000`