escape hatch for analytics events and removed unnecessary console logs

This commit is contained in:
bill bittner 2018-06-07 10:33:15 -07:00
parent 98ea4d226f
commit 18953ed702
3 changed files with 6 additions and 18 deletions

View file

@ -35,14 +35,6 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || functio
var googleId = null; 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) { if (_siteConfig.default && _siteConfig.default.analytics) {
googleId = _siteConfig.default.analytics.googleId; googleId = _siteConfig.default.analytics.googleId;
} }

View file

@ -6,14 +6,6 @@ import siteConfig from '@config/siteConfig.json';
let googleId = null; 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) { if (siteConfig && siteConfig.analytics) {
({ googleId } = siteConfig.analytics); ({ googleId } = siteConfig.analytics);
} }

View file

@ -24,7 +24,9 @@ const createTimingEventParams = (category, variable, label, startTime, endTime)
}; };
const sendGoogleAnalyticsEvent = (ip, params) => { 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 visitorId = ip.replace(/\./g, '-');
const visitor = ua(googleId, visitorId, { strictCidFormat: false, https: true }); const visitor = ua(googleId, visitorId, { strictCidFormat: false, https: true });
visitor.event(params, (err) => { visitor.event(params, (err) => {
@ -36,7 +38,9 @@ const sendGoogleAnalyticsEvent = (ip, params) => {
}; };
const sendGoogleAnalyticsTiming = (siteTitle, 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 }); const visitor = ua(googleId, siteTitle, { strictCidFormat: false, https: true });
visitor.timing(params, (err) => { visitor.timing(params, (err) => {
if (err) { if (err) {