Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/greenstick/interactor
Browse files Browse the repository at this point in the history
  • Loading branch information
greenstick committed Dec 13, 2016
2 parents 89a626e + d893f4c commit ffe125e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
45 changes: 26 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Interactor.js
A simple, light-weight (3KB minified), no dependency, front-end website interaction tracker.
A simple, light-weight (< 5KB minified), no dependency, front-end website interaction tracker.

Collects usage data and submits it to a user-defined server endpoint on the beforeunload event.

Expand All @@ -11,8 +11,6 @@ This data can help you analyze:
* What platforms, language settings, and browser dimensions your users have
* Bounce rates, page and site bottle-necks, impressions, and conversions

Contributions welcome!

## What Data is Provided?

General Data:
Expand Down Expand Up @@ -57,14 +55,15 @@ Include the script in your HTML and invoke it.
<script>
// An example instantiation with custom arguments
var interactions = new Interactor({
interactions : true,
interactionElement : "interaction",
interactionEvents : ["mousedown", "mouseup", "touchstart", "touchend"],
conversions : true,
conversionElement : "conversion",
conversionEvents : ["mouseup", "touchend"],
endpoint : '/usage/interactions',
async : true
interactions : true,
interactionElement : "interaction",
interactionEvents : ["mousedown", "mouseup", "touchstart", "touchend"],
conversions : true,
conversionElement : "conversion",
conversionEvents : ["mouseup", "touchend"],
endpoint : '/usage/interactions',
async : true,
debug : false
});
</script>
</body>
Expand Down Expand Up @@ -102,11 +101,19 @@ Example:
}

## Default Parameters
interactions = true,
interactionElement ='interaction',
interactionEvents = ['mouseup', 'touchend'],
conversions = false,
conversionElement = 'conversion',
conversionEvents = ['mouseup', 'touchend'],
endpoint = '/interactions',
async = true
{
interactions : true,
interactionElement : 'interaction',
interactionEvents : ['mouseup', 'touchend'],
conversions : false,
conversionElement : 'conversion',
conversionEvents : ['mouseup', 'touchend'],
endpoint : '/interactions',
async : true,
debug : true
}

## Contributing
Contributions are welcome!

Next up: addition of Web Socket mode.
4 changes: 2 additions & 2 deletions interactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Interactor.prototype = {

var interactor = this;

// Argument Assignment // Type Checks // Default Values
// Argument Assignment // Type Checks // Default Values
interactor.interactions = typeof(config.interactions) == "boolean" ? config.interations : true,
interactor.interactionElement = typeof(config.interactionElement) == "string" ? config.interactionElement :'interaction',
interactor.interactionEvents = Array.isArray(config.interactionEvents) === true ? config.interactionEvents : ['mouseup', 'touchend'],
Expand Down Expand Up @@ -205,4 +205,4 @@ Interactor.prototype = {
return interactor;
}

};
};

0 comments on commit ffe125e

Please sign in to comment.