add analytics

This commit is contained in:
boryslevytskyi
2017-05-13 21:17:51 +03:00
parent 1bd9eb2f97
commit 4e30d90c58
5 changed files with 19 additions and 4 deletions

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@ BitwiseCmdPages/
.DS_Store .DS_Store
bundle.js bundle.js
bundle.js.map bundle.js.map
npm-debug.log

View File

@@ -1,6 +1,4 @@
# BitwiseCmd # BitwiseCmd
[Bitwise Calculator Online](http://bitwisecmd.com/) [Bitwise Calculator Online](http://bitwisecmd.com/)
Web App that rolls on wheels that I most certainly had to reinvent myself. Nuff said. 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.
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.

View File

@@ -4,7 +4,7 @@
"description": "Bitwise Operations Console", "description": "Bitwise Operations Console",
"main": "index.js", "main": "index.js",
"scripts": { "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", "serv": "webpack-dev-server --content-base ./src",
"e2e": "protractor ./tests/e2e.chrome.js --params.appUrl='http://localhost:8080/#clear'", "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'", "e2e_build": "protractor ./tests/e2e.chrome.js --params.appUrl='http://localhost:3000/#clear'",

15
src/analytics.js Normal file
View File

@@ -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');
})();

View File

@@ -11,5 +11,6 @@
<body> <body>
<div id="root">Ooops... Something went wrong ¯\_(ツ)_/¯</div> <div id="root">Ooops... Something went wrong ¯\_(ツ)_/¯</div>
<script src="bundle.js"></script> <script src="bundle.js"></script>
<script src="analytics.js"></script>
</body> </body>
</html> </html>