Revert "added referrer to serve event analytics"
This reverts commit 0c9e47546c
.
This commit is contained in:
parent
0c9e47546c
commit
b569bfdca6
1 changed files with 15 additions and 24 deletions
|
@ -9,9 +9,8 @@ function createServeEventParams (headers, ip, originalUrl) {
|
||||||
eventLabel : originalUrl,
|
eventLabel : originalUrl,
|
||||||
ipOverride : ip,
|
ipOverride : ip,
|
||||||
userAgentOverride: headers['user-agent'],
|
userAgentOverride: headers['user-agent'],
|
||||||
documentReferrer : headers['referer'],
|
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
function createPublishTimingEventParams (category, variable, label, startTime, endTime) {
|
function createPublishTimingEventParams (category, variable, label, startTime, endTime) {
|
||||||
const duration = endTime - startTime;
|
const duration = endTime - startTime;
|
||||||
|
@ -21,7 +20,7 @@ function createPublishTimingEventParams (category, variable, label, startTime, e
|
||||||
userTimingTime : duration,
|
userTimingTime : duration,
|
||||||
userTimingLabel : label,
|
userTimingLabel : label,
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
function sendGoogleAnalyticsEvent (ip, params) {
|
function sendGoogleAnalyticsEvent (ip, params) {
|
||||||
const visitorId = ip.replace(/\./g, '-');
|
const visitorId = ip.replace(/\./g, '-');
|
||||||
|
@ -30,9 +29,8 @@ function sendGoogleAnalyticsEvent (ip, params) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error('Google Analytics Event Error >>', err);
|
logger.error('Google Analytics Event Error >>', err);
|
||||||
}
|
}
|
||||||
logger.debug(`Event successfully sent to google analytics`);
|
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
function sendGoogleAnalyticsTiming (visitorId, params) {
|
function sendGoogleAnalyticsTiming (visitorId, params) {
|
||||||
const visitor = ua(googleId, visitorId, { strictCidFormat: false, https: true });
|
const visitor = ua(googleId, visitorId, { strictCidFormat: false, https: true });
|
||||||
|
@ -42,25 +40,18 @@ function sendGoogleAnalyticsTiming (visitorId, params) {
|
||||||
}
|
}
|
||||||
logger.debug(`Timing event successfully sent to google analytics`);
|
logger.debug(`Timing event successfully sent to google analytics`);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
function sendGAServeEvent (headers, ip, originalUrl) {
|
|
||||||
logger.debug('headers:', headers);
|
|
||||||
const params = createServeEventParams(headers, ip, originalUrl);
|
|
||||||
sendGoogleAnalyticsEvent(ip, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendGATimingEvent (category, variable, label, startTime, endTime) {
|
|
||||||
const params = createPublishTimingEventParams(category, variable, label, startTime, endTime);
|
|
||||||
sendGoogleAnalyticsTiming(title, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
function chooseGaLbrynetPublishLabel ({ channel_name: channelName, channel_id: channelId }) {
|
|
||||||
return (channelName || channelId ? 'PUBLISH_IN_CHANNEL_CLAIM' : 'PUBLISH_ANONYMOUS_CLAIM');
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
sendGAServeEvent,
|
sendGAServeEvent (headers, ip, originalUrl) {
|
||||||
sendGATimingEvent,
|
const params = createServeEventParams(headers, ip, originalUrl);
|
||||||
chooseGaLbrynetPublishLabel,
|
sendGoogleAnalyticsEvent(ip, params);
|
||||||
|
},
|
||||||
|
sendGATimingEvent (category, variable, label, startTime, endTime) {
|
||||||
|
const params = createPublishTimingEventParams(category, variable, label, startTime, endTime);
|
||||||
|
sendGoogleAnalyticsTiming(title, params);
|
||||||
|
},
|
||||||
|
chooseGaLbrynetPublishLabel ({ channel_name: channelName, channel_id: channelId }) {
|
||||||
|
return (channelName || channelId ? 'PUBLISH_IN_CHANNEL_CLAIM' : 'PUBLISH_ANONYMOUS_CLAIM');
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue