aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/dev-tools-pages/assets/index.html84
-rw-r--r--packages/dev-tools-pages/webpack.config.js5
2 files changed, 48 insertions, 41 deletions
diff --git a/packages/dev-tools-pages/assets/index.html b/packages/dev-tools-pages/assets/index.html
index 73797b958..da7778343 100644
--- a/packages/dev-tools-pages/assets/index.html
+++ b/packages/dev-tools-pages/assets/index.html
@@ -11,40 +11,42 @@
<body>
<!-- Heap SDK -->
<script type="text/javascript">
- (window.heap = window.heap || []),
- (heap.load = function(e, t) {
- (window.heap.appid = e), (window.heap.config = t = t || {});
- var r = t.forceSSL || 'https:' === document.location.protocol,
- a = document.createElement('script');
- (a.type = 'text/javascript'),
- (a.async = !0),
- (a.src = (r ? 'https:' : 'http:') + '//cdn.heapanalytics.com/js/heap-' + e + '.js');
- var n = document.getElementsByTagName('script')[0];
- n.parentNode.insertBefore(a, n);
- for (
- var o = function(e) {
- return function() {
- heap.push([e].concat(Array.prototype.slice.call(arguments, 0)));
- };
- },
- p = [
- 'addEventProperties',
- 'addUserProperties',
- 'clearEventProperties',
- 'identify',
- 'resetIdentity',
- 'removeEventProperty',
- 'setEventProperties',
- 'track',
- 'unsetEventProperty',
- ],
- c = 0;
- c < p.length;
- c++
- )
- heap[p[c]] = o(p[c]);
- });
- heap.load('<%= htmlWebpackPlugin.options.heapAnalyticsId %>');
+ if ('<%= htmlWebpackPlugin.options.environment %>' !== 'development') {
+ (window.heap = window.heap || []),
+ (heap.load = function(e, t) {
+ (window.heap.appid = e), (window.heap.config = t = t || {});
+ var r = t.forceSSL || 'https:' === document.location.protocol,
+ a = document.createElement('script');
+ (a.type = 'text/javascript'),
+ (a.async = !0),
+ (a.src = (r ? 'https:' : 'http:') + '//cdn.heapanalytics.com/js/heap-' + e + '.js');
+ var n = document.getElementsByTagName('script')[0];
+ n.parentNode.insertBefore(a, n);
+ for (
+ var o = function(e) {
+ return function() {
+ heap.push([e].concat(Array.prototype.slice.call(arguments, 0)));
+ };
+ },
+ p = [
+ 'addEventProperties',
+ 'addUserProperties',
+ 'clearEventProperties',
+ 'identify',
+ 'resetIdentity',
+ 'removeEventProperty',
+ 'setEventProperties',
+ 'track',
+ 'unsetEventProperty',
+ ],
+ c = 0;
+ c < p.length;
+ c++
+ )
+ heap[p[c]] = o(p[c]);
+ });
+ heap.load('<%= htmlWebpackPlugin.options.heapAnalyticsId %>');
+ }
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script
@@ -52,13 +54,15 @@
src="https://www.googletagmanager.com/gtag/js?id=<%= htmlWebpackPlugin.options.googleAnalyticsId %>"
></script>
<script>
- window.dataLayer = window.dataLayer || [];
- function gtag() {
- dataLayer.push(arguments);
- }
- gtag('js', new Date());
+ if ('<%= htmlWebpackPlugin.options.environment %>' !== 'development') {
+ window.dataLayer = window.dataLayer || [];
+ function gtag() {
+ dataLayer.push(arguments);
+ }
+ gtag('js', new Date());
- gtag('config', '<%= htmlWebpackPlugin.options.googleAnalyticsId %>');
+ gtag('config', '<%= htmlWebpackPlugin.options.googleAnalyticsId %>');
+ }
</script>
<!-- End Google Analytics -->
<div id="app"></div>
diff --git a/packages/dev-tools-pages/webpack.config.js b/packages/dev-tools-pages/webpack.config.js
index ef2f98cf2..ae70fd83e 100644
--- a/packages/dev-tools-pages/webpack.config.js
+++ b/packages/dev-tools-pages/webpack.config.js
@@ -82,7 +82,10 @@ const config = {
module.exports = (_env, argv) => {
let plugins = [
new CleanWebpackPlugin('public'),
- ...pages.map(p => new HtmlWebpackPlugin(p)),
+ ...pages.map(p => {
+ p.environment = argv.mode;
+ return new HtmlWebpackPlugin(p);
+ }),
new CopyWebpackPlugin([
{ from: 'assets/crawl.html', to: 'index.html' },
{ from: 'assets/fonts', to: 'fonts' },