Only include analytics on production builds
This commit is contained in:
parent
3dd652e7cf
commit
5aba9d698b
@ -11,40 +11,42 @@
|
|||||||
<body>
|
<body>
|
||||||
<!-- Heap SDK -->
|
<!-- Heap SDK -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(window.heap = window.heap || []),
|
if ('<%= htmlWebpackPlugin.options.environment %>' !== 'development') {
|
||||||
(heap.load = function(e, t) {
|
(window.heap = window.heap || []),
|
||||||
(window.heap.appid = e), (window.heap.config = t = t || {});
|
(heap.load = function(e, t) {
|
||||||
var r = t.forceSSL || 'https:' === document.location.protocol,
|
(window.heap.appid = e), (window.heap.config = t = t || {});
|
||||||
a = document.createElement('script');
|
var r = t.forceSSL || 'https:' === document.location.protocol,
|
||||||
(a.type = 'text/javascript'),
|
a = document.createElement('script');
|
||||||
(a.async = !0),
|
(a.type = 'text/javascript'),
|
||||||
(a.src = (r ? 'https:' : 'http:') + '//cdn.heapanalytics.com/js/heap-' + e + '.js');
|
(a.async = !0),
|
||||||
var n = document.getElementsByTagName('script')[0];
|
(a.src = (r ? 'https:' : 'http:') + '//cdn.heapanalytics.com/js/heap-' + e + '.js');
|
||||||
n.parentNode.insertBefore(a, n);
|
var n = document.getElementsByTagName('script')[0];
|
||||||
for (
|
n.parentNode.insertBefore(a, n);
|
||||||
var o = function(e) {
|
for (
|
||||||
return function() {
|
var o = function(e) {
|
||||||
heap.push([e].concat(Array.prototype.slice.call(arguments, 0)));
|
return function() {
|
||||||
};
|
heap.push([e].concat(Array.prototype.slice.call(arguments, 0)));
|
||||||
},
|
};
|
||||||
p = [
|
},
|
||||||
'addEventProperties',
|
p = [
|
||||||
'addUserProperties',
|
'addEventProperties',
|
||||||
'clearEventProperties',
|
'addUserProperties',
|
||||||
'identify',
|
'clearEventProperties',
|
||||||
'resetIdentity',
|
'identify',
|
||||||
'removeEventProperty',
|
'resetIdentity',
|
||||||
'setEventProperties',
|
'removeEventProperty',
|
||||||
'track',
|
'setEventProperties',
|
||||||
'unsetEventProperty',
|
'track',
|
||||||
],
|
'unsetEventProperty',
|
||||||
c = 0;
|
],
|
||||||
c < p.length;
|
c = 0;
|
||||||
c++
|
c < p.length;
|
||||||
)
|
c++
|
||||||
heap[p[c]] = o(p[c]);
|
)
|
||||||
});
|
heap[p[c]] = o(p[c]);
|
||||||
heap.load('<%= htmlWebpackPlugin.options.heapAnalyticsId %>');
|
});
|
||||||
|
heap.load('<%= htmlWebpackPlugin.options.heapAnalyticsId %>');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||||
<script
|
<script
|
||||||
@ -52,13 +54,15 @@
|
|||||||
src="https://www.googletagmanager.com/gtag/js?id=<%= htmlWebpackPlugin.options.googleAnalyticsId %>"
|
src="https://www.googletagmanager.com/gtag/js?id=<%= htmlWebpackPlugin.options.googleAnalyticsId %>"
|
||||||
></script>
|
></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
if ('<%= htmlWebpackPlugin.options.environment %>' !== 'development') {
|
||||||
function gtag() {
|
window.dataLayer = window.dataLayer || [];
|
||||||
dataLayer.push(arguments);
|
function gtag() {
|
||||||
}
|
dataLayer.push(arguments);
|
||||||
gtag('js', new Date());
|
}
|
||||||
|
gtag('js', new Date());
|
||||||
|
|
||||||
gtag('config', '<%= htmlWebpackPlugin.options.googleAnalyticsId %>');
|
gtag('config', '<%= htmlWebpackPlugin.options.googleAnalyticsId %>');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<!-- End Google Analytics -->
|
<!-- End Google Analytics -->
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
@ -82,7 +82,10 @@ const config = {
|
|||||||
module.exports = (_env, argv) => {
|
module.exports = (_env, argv) => {
|
||||||
let plugins = [
|
let plugins = [
|
||||||
new CleanWebpackPlugin('public'),
|
new CleanWebpackPlugin('public'),
|
||||||
...pages.map(p => new HtmlWebpackPlugin(p)),
|
...pages.map(p => {
|
||||||
|
p.environment = argv.mode;
|
||||||
|
return new HtmlWebpackPlugin(p);
|
||||||
|
}),
|
||||||
new CopyWebpackPlugin([
|
new CopyWebpackPlugin([
|
||||||
{ from: 'assets/crawl.html', to: 'index.html' },
|
{ from: 'assets/crawl.html', to: 'index.html' },
|
||||||
{ from: 'assets/fonts', to: 'fonts' },
|
{ from: 'assets/fonts', to: 'fonts' },
|
||||||
|
32
yarn.lock
32
yarn.lock
@ -13461,16 +13461,6 @@ react-dom@^16.3.2:
|
|||||||
object-assign "^4.1.1"
|
object-assign "^4.1.1"
|
||||||
prop-types "^15.6.0"
|
prop-types "^15.6.0"
|
||||||
|
|
||||||
react-dom@^16.4.2:
|
|
||||||
version "16.8.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.1.tgz#ec860f98853d09d39bafd3a6f1e12389d283dbb4"
|
|
||||||
integrity sha512-N74IZUrPt6UiDjXaO7UbDDFXeUXnVhZzeRLy/6iqqN1ipfjrhR60Bp5NuBK+rv3GMdqdIuwIl22u1SYwf330bg==
|
|
||||||
dependencies:
|
|
||||||
loose-envify "^1.1.0"
|
|
||||||
object-assign "^4.1.1"
|
|
||||||
prop-types "^15.6.2"
|
|
||||||
scheduler "^0.13.1"
|
|
||||||
|
|
||||||
react-dom@^16.5.2:
|
react-dom@^16.5.2:
|
||||||
version "16.5.2"
|
version "16.5.2"
|
||||||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.5.2.tgz#b69ee47aa20bab5327b2b9d7c1fe2a30f2cfa9d7"
|
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.5.2.tgz#b69ee47aa20bab5327b2b9d7c1fe2a30f2cfa9d7"
|
||||||
@ -13528,8 +13518,8 @@ react-highlight@0xproject/react-highlight#react-peer-deps:
|
|||||||
dependencies:
|
dependencies:
|
||||||
highlight.js "^9.11.0"
|
highlight.js "^9.11.0"
|
||||||
highlightjs-solidity "^1.0.5"
|
highlightjs-solidity "^1.0.5"
|
||||||
react "^16.5.2"
|
react "^16.4.2"
|
||||||
react-dom "^16.5.2"
|
react-dom "^16.4.2"
|
||||||
|
|
||||||
react-hot-loader@^4.3.3:
|
react-hot-loader@^4.3.3:
|
||||||
version "4.3.4"
|
version "4.3.4"
|
||||||
@ -13774,16 +13764,6 @@ react@^16.3.2:
|
|||||||
object-assign "^4.1.1"
|
object-assign "^4.1.1"
|
||||||
prop-types "^15.6.0"
|
prop-types "^15.6.0"
|
||||||
|
|
||||||
react@^16.4.2:
|
|
||||||
version "16.8.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/react/-/react-16.8.1.tgz#ae11831f6cb2a05d58603a976afc8a558e852c4a"
|
|
||||||
integrity sha512-wLw5CFGPdo7p/AgteFz7GblI2JPOos0+biSoxf1FPsGxWQZdN/pj6oToJs1crn61DL3Ln7mN86uZ4j74p31ELQ==
|
|
||||||
dependencies:
|
|
||||||
loose-envify "^1.1.0"
|
|
||||||
object-assign "^4.1.1"
|
|
||||||
prop-types "^15.6.2"
|
|
||||||
scheduler "^0.13.1"
|
|
||||||
|
|
||||||
react@^16.5.2:
|
react@^16.5.2:
|
||||||
version "16.5.2"
|
version "16.5.2"
|
||||||
resolved "https://registry.yarnpkg.com/react/-/react-16.5.2.tgz#19f6b444ed139baa45609eee6dc3d318b3895d42"
|
resolved "https://registry.yarnpkg.com/react/-/react-16.5.2.tgz#19f6b444ed139baa45609eee6dc3d318b3895d42"
|
||||||
@ -14655,14 +14635,6 @@ schedule@^0.5.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
object-assign "^4.1.1"
|
object-assign "^4.1.1"
|
||||||
|
|
||||||
scheduler@^0.13.1:
|
|
||||||
version "0.13.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.13.1.tgz#1a217df1bfaabaf4f1b92a9127d5d732d85a9591"
|
|
||||||
integrity sha512-VJKOkiKIN2/6NOoexuypwSrybx13MY7NSy9RNt8wPvZDMRT1CW6qlpF5jXRToXNHz3uWzbm2elNpZfXfGPqP9A==
|
|
||||||
dependencies:
|
|
||||||
loose-envify "^1.1.0"
|
|
||||||
object-assign "^4.1.1"
|
|
||||||
|
|
||||||
schema-utils@^0.4.4:
|
schema-utils@^0.4.4:
|
||||||
version "0.4.7"
|
version "0.4.7"
|
||||||
resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187"
|
resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user