diff --git a/.eslintrc.yml b/.eslintrc.yml index f1c43d95c..eb1b1779a 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -6,6 +6,7 @@ env: globals: angular: true + __CONFIG_GA_ID: true extends: - 'eslint:recommended' diff --git a/app/config.js b/app/config.js index d32212133..0ab6b60c2 100644 --- a/app/config.js +++ b/app/config.js @@ -40,7 +40,7 @@ angular.module('portainer') }; }]); - AnalyticsProvider.setAccount('@@CONFIG_GA_ID'); + AnalyticsProvider.setAccount({ tracker: __CONFIG_GA_ID, set: { anonymizeIp: true } }); AnalyticsProvider.startOffline(true); toastr.options.timeOut = 3000; diff --git a/gruntfile.js b/gruntfile.js index 6721448f3..06c51e42e 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -78,7 +78,6 @@ module.exports = function(grunt) { distdir: 'dist/public', shippedDockerVersion: '18.09.3', shippedDockerVersionWindows: '17.09.0-ce', - pkg: grunt.file.readJSON('package.json'), config: gruntfile_cfg.config, src: gruntfile_cfg.src, clean: gruntfile_cfg.clean, @@ -99,7 +98,7 @@ gruntfile_cfg.env = { prod: { NODE_ENV: 'production' } -} +}; gruntfile_cfg.webpack = { dev: webpackDevConfig, diff --git a/webpack/webpack.common.js b/webpack/webpack.common.js index e34108e2f..317d4edda 100644 --- a/webpack/webpack.common.js +++ b/webpack/webpack.common.js @@ -1,5 +1,6 @@ const path = require('path'); -const { ProvidePlugin, IgnorePlugin } = require('webpack'); +const pkg = require('../package.json'); +const { ProvidePlugin, IgnorePlugin, DefinePlugin } = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const WebpackBuildNotifierPlugin = require('webpack-build-notifier'); const CleanTerminalPlugin = require('clean-terminal-webpack-plugin'); @@ -94,6 +95,9 @@ module.exports = { new LodashModuleReplacementPlugin({ shorthands: true, collections: true + }), + new DefinePlugin({ + __CONFIG_GA_ID: JSON.stringify(pkg.config.GA_ID), }) ], optimization: {