[refactor] Google Analytics is controlled by Webpack

This commit is contained in:
Steven Evans 2018-08-30 11:08:08 -04:00
parent 552ce183c1
commit 2deeaef349
3 changed files with 11 additions and 4 deletions

@ -20,7 +20,8 @@
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), (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) m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
</script>
<script>
ga('create', 'UA-100157497-1', 'auto'); ga('create', 'UA-100157497-1', 'auto');
ga('send', 'pageview'); ga('send', 'pageview');
</script> </script>

@ -20,10 +20,13 @@
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), (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) m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
</script><%
ga('create', 'UA-100157497-1', 'auto'); if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
<script>
ga('create', '<%= htmlWebpackPlugin.options.googleAnalytics.trackingId %>', 'auto');
ga('send', 'pageview'); ga('send', 'pageview');
</script> </script><%
} %>
</head> </head>
<body> <body>
<div id="entire-game-container" style="visibility:hidden;"> <div id="entire-game-container" style="visibility:hidden;">

@ -21,6 +21,9 @@ module.exports = (env, argv) => ({
title: "Bitburner" + (argv.mode === 'development' ? ' - development' : ""), title: "Bitburner" + (argv.mode === 'development' ? ' - development' : ""),
template: "src/index.html", template: "src/index.html",
favicon: "favicon.ico", favicon: "favicon.ico",
googleAnalytics: {
trackingId: 'UA-100157497-1'
},
meta: {}, meta: {},
minify: argv.mode === 'development' ? false : { minify: argv.mode === 'development' ? false : {
collapseBooleanAttributes: true, collapseBooleanAttributes: true,