removed unneeded 'show' analytics

This commit is contained in:
bill bittner 2017-07-05 08:13:01 -07:00
parent 50669d8e40
commit d1a219ef03
3 changed files with 6 additions and 25 deletions

View file

@ -38,13 +38,6 @@ module.exports = {
} }
}); });
break; break;
case 'show':
visitor.pageview(originalUrl, 'https://spee.ch', 'show route', (err) => {
if (err) {
logger.error('Google Analytics Pageview Error >>', err);
}
});
break;
case 'publish': case 'publish':
visitor.event('publish', originalUrl, (err) => { visitor.event('publish', originalUrl, (err) => {
if (err) { if (err) {

View file

@ -1,11 +1,9 @@
const logger = require('winston'); const logger = require('winston');
const { postToStats, sendGoogleAnalytics } = require('../controllers/statsController.js'); const { postToStats } = require('../controllers/statsController.js');
module.exports = app => { module.exports = app => {
// route for the home page // route for the home page
app.get('/', ({ headers, ip, originalUrl }, res) => { app.get('/', ({ headers, ip, originalUrl }, res) => {
// google analytics
sendGoogleAnalytics('serve', ip, originalUrl);
// logging // logging
logger.verbose(`GET request on ${originalUrl} from ${ip}`); logger.verbose(`GET request on ${originalUrl} from ${ip}`);
// send response // send response
@ -13,8 +11,6 @@ module.exports = app => {
}); });
// a catch-all route if someone visits a page that does not exist // a catch-all route if someone visits a page that does not exist
app.use('*', ({ originalUrl, ip }, res) => { app.use('*', ({ originalUrl, ip }, res) => {
// google analytics
sendGoogleAnalytics('serve', ip, originalUrl);
// logging // logging
logger.error(`Get request on ${originalUrl} from ${ip} which was a 404`); logger.error(`Get request on ${originalUrl} from ${ip} which was a 404`);
// post to stats // post to stats

View file

@ -1,26 +1,18 @@
const logger = require('winston'); const logger = require('winston');
const errorHandlers = require('../helpers/libraries/errorHandlers.js'); const errorHandlers = require('../helpers/libraries/errorHandlers.js');
const { getAllClaims } = require('../controllers/showController.js'); const { getAllClaims } = require('../controllers/showController.js');
const { getStatsSummary, postToStats, sendGoogleAnalytics } = require('../controllers/statsController.js'); const { getStatsSummary, postToStats } = require('../controllers/statsController.js');
function sendAnalyticsAndLog (ip, originalUrl) {
// google analytics
sendGoogleAnalytics('show', ip, originalUrl);
// logging
logger.verbose(`POST request on ${originalUrl} from ${ip}`);
// get and serve the content
}
module.exports = (app) => { module.exports = (app) => {
// route to show 'about' page for spee.ch // route to show 'about' page for spee.ch
app.get('/about', ({ ip, originalUrl }, res) => { app.get('/about', ({ ip, originalUrl }, res) => {
sendAnalyticsAndLog(ip, originalUrl); logger.verbose(`POST request on ${originalUrl} from ${ip}`);
// get and render the content // get and render the content
res.status(200).render('about'); res.status(200).render('about');
}); });
// route to show the meme-fodder meme maker // route to show the meme-fodder meme maker
app.get('/meme-fodder/play', ({ ip, originalUrl }, res) => { app.get('/meme-fodder/play', ({ ip, originalUrl }, res) => {
sendAnalyticsAndLog(ip, originalUrl); logger.verbose(`POST request on ${originalUrl} from ${ip}`);
// get and render the content // get and render the content
getAllClaims('meme-fodder') getAllClaims('meme-fodder')
.then(orderedFreePublicClaims => { .then(orderedFreePublicClaims => {
@ -33,7 +25,7 @@ module.exports = (app) => {
}); });
// route to show statistics for spee.ch // route to show statistics for spee.ch
app.get('/stats', ({ ip, originalUrl }, res) => { app.get('/stats', ({ ip, originalUrl }, res) => {
sendAnalyticsAndLog(ip, originalUrl); logger.verbose(`POST request on ${originalUrl} from ${ip}`);
// get and render the content // get and render the content
getStatsSummary() getStatsSummary()
.then(result => { .then(result => {
@ -46,7 +38,7 @@ module.exports = (app) => {
}); });
// route to display all free public claims at a given name // route to display all free public claims at a given name
app.get('/:name/all', ({ ip, originalUrl, params }, res) => { app.get('/:name/all', ({ ip, originalUrl, params }, res) => {
sendAnalyticsAndLog(ip, originalUrl); logger.verbose(`POST request on ${originalUrl} from ${ip}`);
// get and render the content // get and render the content
getAllClaims(params.name) getAllClaims(params.name)
.then(orderedFreePublicClaims => { .then(orderedFreePublicClaims => {