Giter VIP home page Giter VIP logo

musjs's Introduction

GitHub license Coverage

mus.js

A simple mouse tracking library to provide insights on how your users are handling your layout / user experience.

This library was created so you don't need an external service to "record" your users mouse events and "play" them in a later moment.

mus works with any AMD you wish and its setup is extremely simple - 5.6kb

Recording

// Instantiate a mus object
var mus = new Mus();

// Start recording
mus.record();

// After a while, stops
setTimeout(function() {
  mus.stop();
}, 5000);

Playing

// Sets playback speed (optional, default NORMAL)
mus.setPlaybackSpeed(mus.speed.SLOW);

// Starts playing and enjoy
mus.play();

Example

Public methods

Controls

record()

Starts a recording session for current screen. If there is already a session recorded, it appends to it.

stop()

Stops a recording or a playback.

play(onfinish)

Plays current recording session.

pause()

Pauses current playback.

release()

Releases all data recorded or set.

Getters and setters

getData()

Returns all data collected during recording.

setData(data)

Sets custom data for playback. It must be a JSON object collected from getData.

setFrames(frames)

Same as setData, but allows only to set the frames array.

setWindowSize(width, height)

During recording, all data collected contains window dimensions as well, so if your recorded data comes from a different window dimension, mus automatically adapts to current window size. This function allows you to set a custom playback window size if you decide to use setFrames instead of setData (that already sets windows dimensions).

setPlaybackSpeed(speed)

Allows playback to be faster or slower. Default constants: mus.speed.SLOW (35), mus.speed.NORMAL (15), mus.speed.FAST (5) You may decide to use custom values as you wish.

setTimePoint(bool)

Records time elapsed for each point for a precise data recording. Default: disabled

isRecording()

Informs if mus is currently recording something.

isPlaying()

Informs if mus is currently playing something.

isTimePoint()

Informs if mus is recording time for each data point.

Roadmap

  • Detect touch movements and clicks;
  • Get form inputs;
  • Allows real clicks during setup (default false);
  • Suggestions are greatly appreciated!

Version history

v1.1.0

  • Added time point recording for precise data;

v1.0.1

  • Added minified file for distribution;

License

MIT

musjs's People

Contributors

iamparsa avatar mauriciogior avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.