From 4e30d90c5864fa7b7512b6076ecddd00e96446a3 Mon Sep 17 00:00:00 2001 From: boryslevytskyi Date: Sat, 13 May 2017 21:17:51 +0300 Subject: [PATCH] add analytics --- .gitignore | 1 + README.md | 4 +--- package.json | 2 +- src/analytics.js | 15 +++++++++++++++ src/index.html | 1 + 5 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 src/analytics.js diff --git a/.gitignore b/.gitignore index 0fe434f..9fdd179 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ BitwiseCmdPages/ .DS_Store bundle.js bundle.js.map +npm-debug.log diff --git a/README.md b/README.md index ae9ca16..0a29708 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ # BitwiseCmd [Bitwise Calculator Online](http://bitwisecmd.com/) -Web App that rolls on wheels that I most certainly had to reinvent myself. Nuff said. - -It helps better understand how bitwise operations are pefromed by displaying bytes in a way you can actually see what is going on there during AND, OR, XOR or shift operations. +Web App that helps better understand how bitwise operations are pefromed by displaying bytes in a way you can actually see what is going on there during AND, OR, XOR or shift operations. diff --git a/package.json b/package.json index 665b987..dfff64f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Bitwise Operations Console", "main": "index.js", "scripts": { - "build": "rm -rf ./BitwiseCmdPages/* && cp ./src/index.html ./BitwiseCmdPages && cp ./src/bundle.js ./BitwiseCmdPages && cp ./src/bundle.js.map ./BitwiseCmdPages && cp -r ./src/css ./BitwiseCmdPages && cp -r ./src/img ./BitwiseCmdPages", + "build": "webpack -p && rm -rf ./BitwiseCmdPages/* && cp ./src/index.html ./BitwiseCmdPages && cp ./src/*.js ./BitwiseCmdPages && cp ./src/bundle.js.map ./BitwiseCmdPages && cp -r ./src/css ./BitwiseCmdPages && cp -r ./src/img ./BitwiseCmdPages", "serv": "webpack-dev-server --content-base ./src", "e2e": "protractor ./tests/e2e.chrome.js --params.appUrl='http://localhost:8080/#clear'", "e2e_build": "protractor ./tests/e2e.chrome.js --params.appUrl='http://localhost:3000/#clear'", diff --git a/src/analytics.js b/src/analytics.js new file mode 100644 index 0000000..82d9879 --- /dev/null +++ b/src/analytics.js @@ -0,0 +1,15 @@ +(function() { + + if(window.location.host != 'bitwisecmd.com' || window.location.hash.indexOf('-notrack') > -1) { + console.log("Analytics not tracked") + return; + } + + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + + ga('create', 'UA-61569164-1', 'auto'); + ga('send', 'pageview'); +})(); \ No newline at end of file diff --git a/src/index.html b/src/index.html index d099073..a90d823 100644 --- a/src/index.html +++ b/src/index.html @@ -11,5 +11,6 @@
Ooops... Something went wrong ¯\_(ツ)_/¯
+ \ No newline at end of file