Fix configs loading #470

Merged
bones7242 merged 15 commits from fix-configs-loading into master 2018-06-07 19:40:01 +02:00
3 changed files with 6 additions and 18 deletions
Showing only changes of commit 18953ed702 - Show all commits

View file

@ -35,14 +35,6 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || functio
var googleId = null;
if (!_siteConfig.default) {
console.log('WARNING: no site config found for GAListener');
}
if (!_siteConfig.default.analytics) {
console.log('WARNING: no analytics configs found in siteConfig.json');
}
if (_siteConfig.default && _siteConfig.default.analytics) {
googleId = _siteConfig.default.analytics.googleId;
}

View file

@ -6,14 +6,6 @@ import siteConfig from '@config/siteConfig.json';
let googleId = null;
if (!siteConfig) {
console.log('WARNING: no site config found for GAListener');
}
if (!siteConfig.analytics) {
console.log('WARNING: no analytics configs found in siteConfig.json');
}
if (siteConfig && siteConfig.analytics) {
({ googleId } = siteConfig.analytics);
}

View file

@ -24,7 +24,9 @@ const createTimingEventParams = (category, variable, label, startTime, endTime)
};
const sendGoogleAnalyticsEvent = (ip, params) => {
logger.debug('googleId', googleId);
if (!googleId) {
return logger.debug('Skipping analytics event because no GoogleId present in configs');
}
const visitorId = ip.replace(/\./g, '-');
const visitor = ua(googleId, visitorId, { strictCidFormat: false, https: true });
visitor.event(params, (err) => {
@ -36,7 +38,9 @@ const sendGoogleAnalyticsEvent = (ip, params) => {
};
const sendGoogleAnalyticsTiming = (siteTitle, params) => {
logger.debug('googleId', googleId);
if (!googleId) {
return logger.debug('Skipping analytics timing because no GoogleId present in configs');
}
const visitor = ua(googleId, siteTitle, { strictCidFormat: false, https: true });
visitor.timing(params, (err) => {
if (err) {