partial for analytics
This commit is contained in:
parent
2244240dc8
commit
8a99de88ae
9 changed files with 101 additions and 69 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
50
package-lock.json
generated
50
package-lock.json
generated
|
|
@ -2924,6 +2924,12 @@
|
|||
"integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==",
|
||||
"dev": true
|
||||
},
|
||||
"fs": {
|
||||
"version": "0.0.1-security",
|
||||
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
|
||||
"integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=",
|
||||
"dev": true
|
||||
},
|
||||
"fs-minipass": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
|
||||
|
|
@ -3132,6 +3138,17 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"html-webpack-partials-plugin": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmjs.org/html-webpack-partials-plugin/-/html-webpack-partials-plugin-0.8.0.tgz",
|
||||
"integrity": "sha512-JJMtu3R2vjohfH/o6JTMOapcZm3304qj5ct920Gk2NHzl4ldflf9lRFK1JWaubXraaTPT0Xn3wEXih71/9lZJw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fs": "^0.0.1-security",
|
||||
"lodash": "^4.17.20",
|
||||
"path": "^0.12.7"
|
||||
}
|
||||
},
|
||||
"html-webpack-plugin": {
|
||||
"version": "4.5.1",
|
||||
"resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-4.5.1.tgz",
|
||||
|
|
@ -4062,6 +4079,16 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"path": {
|
||||
"version": "0.12.7",
|
||||
"resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
|
||||
"integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"process": "^0.11.1",
|
||||
"util": "^0.10.3"
|
||||
}
|
||||
},
|
||||
"path-exists": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||
|
|
@ -5815,6 +5842,12 @@
|
|||
"renderkid": "^2.0.4"
|
||||
}
|
||||
},
|
||||
"process": {
|
||||
"version": "0.11.10",
|
||||
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=",
|
||||
"dev": true
|
||||
},
|
||||
"progress": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
|
||||
|
|
@ -6590,6 +6623,23 @@
|
|||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"util": {
|
||||
"version": "0.10.4",
|
||||
"resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
|
||||
"integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"inherits": "2.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
"css-loader": "^5.0.1",
|
||||
"css-minimizer-webpack-plugin": "^1.2.0",
|
||||
"eslint": "^7.18.0",
|
||||
"html-webpack-partials-plugin": "^0.8.0",
|
||||
"html-webpack-plugin": "^4.5.1",
|
||||
"mini-css-extract-plugin": "^1.3.4",
|
||||
"style-loader": "^2.0.0",
|
||||
|
|
|
|||
|
|
@ -2,30 +2,6 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-136831794-2"></script>
|
||||
<script>
|
||||
// Temporarily disable the tracking for testing (set to false to enable Analytics)
|
||||
window['ga-disable-UA-136831794-2'] = false;
|
||||
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
|
||||
function gtag() {
|
||||
dataLayer.push(arguments);
|
||||
}
|
||||
|
||||
// Default no consent to share cookie data
|
||||
/* gtag('consent', 'default', {
|
||||
'ad_storage': 'denied',
|
||||
'analytics_storage': 'denied'
|
||||
}); */
|
||||
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'UA-136831794-2');
|
||||
</script>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link href="favicon.png" rel="icon">
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
/* eslint-disable no-undef */
|
||||
// Temporarily disable the tracking for testing (set to false to enable Analytics)
|
||||
window['ga-disable-UA-136831794-2'] = false;
|
||||
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
|
||||
function gtag() {
|
||||
dataLayer.push(arguments);
|
||||
}
|
||||
|
||||
// Default no consent to share cookie data
|
||||
gtag('consent', 'default', {
|
||||
'ad_storage': 'denied',
|
||||
'analytics_storage': 'denied'
|
||||
});
|
||||
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'UA-136831794-2');
|
||||
|
|
@ -10,9 +10,6 @@ require("../img/thumbnail1200x628.jpg");
|
|||
// Instantly load test save file from .json (fast Debugging script)
|
||||
// require("./LoadJson.js");
|
||||
|
||||
// Google Analytics start script
|
||||
// require("./analytics.js")
|
||||
|
||||
// Load Save File for opening files, decoding, decryption
|
||||
require("./LoadSaveFile.js");
|
||||
|
||||
|
|
|
|||
22
src/partials/analytics.html
Normal file
22
src/partials/analytics.html
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= ga_property_id %>"></script>
|
||||
<script>
|
||||
// Temporarily disable the tracking for testing (set to false to enable Analytics)
|
||||
window['ga-disable-<%= ga_property_id %>'] = true;
|
||||
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
|
||||
function gtag() {
|
||||
dataLayer.push(arguments);
|
||||
}
|
||||
|
||||
// Default no consent to share cookie data
|
||||
/* gtag('consent', 'default', {
|
||||
'ad_storage': 'denied',
|
||||
'analytics_storage': 'denied'
|
||||
}); */
|
||||
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '<%= ga_property_id %>');
|
||||
</script>
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
/* global require module __dirname */
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const HtmlWebpackPartialsPlugin = require('html-webpack-partials-plugin');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
// const TerserPlugin = require('terser-webpack-plugin');
|
||||
const {
|
||||
CleanWebpackPlugin
|
||||
} = require('clean-webpack-plugin');
|
||||
|
|
@ -14,12 +15,12 @@ module.exports = {
|
|||
mode: 'production',
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
/* minimizer: [
|
||||
new TerserPlugin({
|
||||
extractComments: false,
|
||||
}),
|
||||
new CssMinimizerPlugin(),
|
||||
],
|
||||
], */
|
||||
},
|
||||
output: {
|
||||
path: `${__dirname}/docs`,
|
||||
|
|
@ -37,7 +38,28 @@ module.exports = {
|
|||
chunks: ['index'],
|
||||
filename: 'index.html',
|
||||
favicon: "./src/favicon.png",
|
||||
})
|
||||
minify: {
|
||||
// Begin HTML Webpack Plugin Default
|
||||
collapseWhitespace: true,
|
||||
removeComments: true,
|
||||
removeRedundantAttributes: true,
|
||||
removeScriptTypeAttributes: true,
|
||||
removeStyleLinkTypeAttributes: true,
|
||||
useShortDoctype: true,
|
||||
// End HTML Webpack Plugin Default
|
||||
minifyJS: true,
|
||||
minifyCSS: true,
|
||||
},
|
||||
}),
|
||||
new HtmlWebpackPartialsPlugin({
|
||||
path: './src/partials/analytics.html',
|
||||
location: 'head',
|
||||
priority: 'high',
|
||||
options: {
|
||||
ga_property_id: 'UA-136831794-2'
|
||||
}
|
||||
}),
|
||||
new CssMinimizerPlugin(),
|
||||
],
|
||||
module: {
|
||||
rules: [{
|
||||
|
|
|
|||
Loading…
Reference in a new issue