diff --git a/client.js b/client.js new file mode 100644 index 0000000..fb9428d --- /dev/null +++ b/client.js @@ -0,0 +1,29 @@ +// Include Socket.io script before this +// https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.3/socket.io.js + +(function (history) { + var pushState = history.pushState; + history.pushState = function (state) { + if (typeof history.onpushstate == "function") { + history.onpushstate({ + state: state + }); + }; + visitorData.page = document.URL; + + + return pushState.apply(history, arguments); + }; +})(window.history); + +var socket = io('https://breeze.thefeathers.in'); +var visitorData = { + referringSite: document.referrer, + domain: window.parent.location.hostname, + page: document.URL, + userAgent: navigator.userAgent +} +var emit = function () { + socket.emit('visitor-data', visitorData); +} +emit(); \ No newline at end of file diff --git a/package.json b/package.json index 9f917b2..cd72a39 100644 --- a/package.json +++ b/package.json @@ -1,27 +1,29 @@ { - "name": "breeze-analytics", + "name": "minal", "version": "0.0.1", - "description": "Web analytics like a breeze", + "description": "Blazing fast, minimal web analytics", "main": "server.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { "type": "git", - "url": "git+https://github.com/codefeathers/breeze-analytics.git" + "url": "git+https://github.com/codefeathers/minal.git" }, "keywords": [ - "breeze", + "minal", + "fast", + "minimal", "analytics", "website", "monitoring" ], - "author": "Muthu Kumar (https://mkr.pw)", + "author": "Muthu Kumar <@MKRhere> ", "license": "MIT", "bugs": { - "url": "https://github.com/codefeathers/breeze-analytics/issues" + "url": "https://github.com/codefeathers/minal/issues" }, - "homepage": "https://github.com/codefeathers/breeze-analytics#readme", + "homepage": "https://github.com/codefeathers/minal#readme", "dependencies": { "express": "^4.16.2", "socket.io": "^2.0.4"