- npm updates

- matomo environment variables via .env file + matomo code in main.js
This commit is contained in:
Arno Kaimbacher 2021-05-25 09:57:06 +02:00
parent 9781536e37
commit c2b0b2c39d
5 changed files with 839 additions and 1122 deletions

1927
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
"main": "dist/main.js",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.2",
"@types/three": "^0.127.1",
"@types/three": "^0.128.0",
"bulma": "^0.9.2",
"lodash": "^4.17.21",
"normalize.css": "^8.0.1",
@ -25,12 +25,12 @@
"babel-loader": "^8.2.1",
"concurrently": "^6.0.0",
"css-loader": "^5.0.1",
"dotenv": "^8.2.0",
"dotenv": "^10.0.0",
"file-loader": "^6.2.0",
"img-loader": "^3.0.2",
"img-loader": "^4.0.0",
"mini-css-extract-plugin": "^1.3.1",
"node-sass": "^5.0.0",
"resolve-url-loader": "^3.1.2",
"node-sass": "^6.0.0",
"resolve-url-loader": "^4.0.0",
"sass-loader": "^11.0.1",
"style-loader": "^2.0.0",
"terser-webpack-plugin": "^5.0.3",

View File

@ -192,7 +192,7 @@ export class NorthArrow extends Control {
let _padding = 3;
let borderWidth = 0;
let _borderRadius = 0;
let borderColor = 'white';
// let borderColor = 'white';
let strokeWidth = 0;
let strokeColor = 'white';

View File

@ -71,6 +71,25 @@ class Application {
async build() {
await this.createScene();
this.addEventListeners();
// add matomo code if defined in .env file:
if (ENVIRONMENT == "production" && MATOMO_TRACKER_URL != null && MATOMO_SITE_ID != null) {
let _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
let u = MATOMO_TRACKER_URL;
_paq.push(['setTrackerUrl', u + 'matomo.php']);
_paq.push(['setSiteId', MATOMO_SITE_ID]);
let d = document; let g = d.createElement('script');
let s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript';
g.async = true;
g.src = u + 'matomo.js';
s.parentNode.insertBefore(g, s);
})();
}
}
async createScene() {

View File

@ -153,6 +153,9 @@ module.exports = {
new webpack.DefinePlugin({ // Remove this plugin if you don't plan to define any global constants
ENVIRONMENT: JSON.stringify(process.env.NODE_ENV),
CONSTANT_VALUE: JSON.stringify(process.env.CONSTANT_VALUE),
MATOMO_SITE_ID: JSON.stringify(process.env.MATOMO_SITE_ID),
MATOMO_TRACKER_URL: JSON.stringify(process.env.MATOMO_TRACKER_URL),
CUSTOM_VAR: JSON.stringify('value5 goes here'), // no quotes needed, string value
}),
// extractLess,