bluesmoon/boomerang — pull request #13 by andreas-marschke (2014-09-29 01:30:46+00:00)
Title: clicks.js: Plugin for clicktracking

Using this plugin you can track every click a user makes on a page.
Configuring it is works as follows:

```javascript
BOOMR.init({
beacon_url: "",
clicks: {
click_url : "http://",
onbeforeunload : false
}});
```

Using a seperate url allows to have a seperate server responsible for
handling a bigger load than your beacon server given that a typical
user will be clicking more than once on an average page.

You can use this plugin in one of two ways:

- `onbeforeunload : false` => Sends click-tracking beacons immediately
upon click_events happening
- `onbeforeunload : true` => All Clicks that have been tracked are
sent at once upon closing the page

Data sent to the beacon-server will contain the following:

- `element`: the name of the element that has been clicked
(li,a,button,span etc)
- `id`: possibly set ids on the element
- `class`: a list of all classes assigned to the element
- `document height/width`: the size of the document
- `viewport height/width`: the size of the browser window

Information like this allows you (for example) to drill deeper into
what impact a change in the UI had(AB-Testing) or see which size most
users view your page which can allow for better optimized media-queries
for the formats used by the user base and heatmaps for the page as it
exists.