Skip to content

JavaScript plugin for measuring how much time users spend watching your web site

License

Notifications You must be signed in to change notification settings

olefrank/inviewTracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InViewTracker

Current version: 0.2

InViewTracker is a lightweight JavaScript plugin useful for tracking how much time users spend viewing certain content on your web pages. News papers or blogs use InViewTracker to track how much time each user spends on reading articles on their website. Make sure all articles are within a container element (e.g. #article), include InViewTracker on your pages and start tracking!

Available at my github

Compatibility

InViewTracker should work in all modern browsers

I've tested InViewTracker on:

  • Chrome 32+
  • Firefox 28+
  • IE 9+
  • Safari for Windows 5.1+

Features

Coming soon!

Options

  • element which element to track (default: ".article")
  • pctInView percentage that the element must fill the screen to be "in view" (default: 50)
  • eventHandler name of external function to handle event broadcasting
  • heartbeatInterval interval (milliseconds) between heart beats (default: 2000 = 2 secs)
  • heartbeatExpires how long (milliseconds) before heartbeat stops (default: 180000 = 3 mins)
  • heartbeatTimeout how long (milliseconds) with inactivity before heartbeat stops (default: 30000 = 30 secs)

Demos

In the '''demo''' folder you can find various HTML pages to demo the plugin. Open the browsers console to view events.

Changelog

  • 0.2 Added property "heartbeatTimeout": used to ensure that InViewTracker does not calculate time spent in view when computer is left unattended (defaults to 30 seconds)
  • 0.1 Initial release

Contributing

Bug reports and code contributions are welcome. Please see CONTRIBUTIONS.md.

Contact

If you have any questions you can find me on Twitter at @olefrankjensen.

Inspiration

In making this plugin I was inspired by:

  • Viljami S wrote a blog post about migrating from jQuery to Vanilla JavaScript. I used some of his suggestion how to decide when an element is in view.
  • Addi Osmani wrote a great (free) book about JavaScript programming. I used the "Revealing Module Pattern" for my plugin 'cause it's just - nice!

About

JavaScript plugin for measuring how much time users spend watching your web site

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published