website
statistics
currently in private beta

glance browser object API

glance tracking code

To add the glance.min.js file to your website, use this Javascript snippet that tracks the activity.

(function(g, l, a, n, c, e, cw) {
  g['GlanceAnalyticsObject'] = c; g[c] = g[c] || function() {
    (g[c].q = g[c].q || []).push(arguments)
  }, g[c].t = new Date().getTime();
  g[c].API = 'path/to/track.php'; //window[...]
  e = l.createElement(a), cw = l.getElementsByTagName(a)[0];
  e.async = 1; e.src = n; cw.parentNode.insertBefore(e, cw)
})(window, document, 'script', '//path/to/glance.min.js', 'glance');

glance('pageview');
path/to/track.php string the path to your track.php file
//path/to/glance.min.js string the path to your glance.min.js file

page events

Page Events are sent using the following code:

glance('event', 'event_name', { id : 999, msg : "hello" }, function(n,data) {
  console.log('cb:', n, data)
});
event string define we are sending an event, always set to 'event'
event_name string the name of the event
event_data JSON the data from the event
callback function a callback used to execute after the event is sent

user info

Using window['glance'].details, we can get some basic visitor info:

> window['glance'].details
< { numOfVisits: 1, firstVisitDate: "20180409", newVisit: false }
numOfVisits integer number of times this user has been to your site
firstVisitDate string first time this user has visited, sample: '20180409' (YYYYMMDD)
newVisit boolean is this the first time this user has visited