removed unneeded 'show' analytics
This commit is contained in:
parent
50669d8e40
commit
d1a219ef03
3 changed files with 6 additions and 25 deletions
|
@ -38,13 +38,6 @@ module.exports = {
|
|||
}
|
||||
});
|
||||
break;
|
||||
case 'show':
|
||||
visitor.pageview(originalUrl, 'https://spee.ch', 'show route', (err) => {
|
||||
if (err) {
|
||||
logger.error('Google Analytics Pageview Error >>', err);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'publish':
|
||||
visitor.event('publish', originalUrl, (err) => {
|
||||
if (err) {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
const logger = require('winston');
|
||||
const { postToStats, sendGoogleAnalytics } = require('../controllers/statsController.js');
|
||||
const { postToStats } = require('../controllers/statsController.js');
|
||||
|
||||
module.exports = app => {
|
||||
// route for the home page
|
||||
app.get('/', ({ headers, ip, originalUrl }, res) => {
|
||||
// google analytics
|
||||
sendGoogleAnalytics('serve', ip, originalUrl);
|
||||
// logging
|
||||
logger.verbose(`GET request on ${originalUrl} from ${ip}`);
|
||||
// send response
|
||||
|
@ -13,8 +11,6 @@ module.exports = app => {
|
|||
});
|
||||
// a catch-all route if someone visits a page that does not exist
|
||||
app.use('*', ({ originalUrl, ip }, res) => {
|
||||
// google analytics
|
||||
sendGoogleAnalytics('serve', ip, originalUrl);
|
||||
// logging
|
||||
logger.error(`Get request on ${originalUrl} from ${ip} which was a 404`);
|
||||
// post to stats
|
||||
|
|
|
@ -1,26 +1,18 @@
|
|||
const logger = require('winston');
|
||||
const errorHandlers = require('../helpers/libraries/errorHandlers.js');
|
||||
const { getAllClaims } = require('../controllers/showController.js');
|
||||
const { getStatsSummary, postToStats, sendGoogleAnalytics } = 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
|
||||
}
|
||||
const { getStatsSummary, postToStats } = require('../controllers/statsController.js');
|
||||
|
||||
module.exports = (app) => {
|
||||
// route to show 'about' page for spee.ch
|
||||
app.get('/about', ({ ip, originalUrl }, res) => {
|
||||
sendAnalyticsAndLog(ip, originalUrl);
|
||||
logger.verbose(`POST request on ${originalUrl} from ${ip}`);
|
||||
// get and render the content
|
||||
res.status(200).render('about');
|
||||
});
|
||||
// route to show the meme-fodder meme maker
|
||||
app.get('/meme-fodder/play', ({ ip, originalUrl }, res) => {
|
||||
sendAnalyticsAndLog(ip, originalUrl);
|
||||
logger.verbose(`POST request on ${originalUrl} from ${ip}`);
|
||||
// get and render the content
|
||||
getAllClaims('meme-fodder')
|
||||
.then(orderedFreePublicClaims => {
|
||||
|
@ -33,7 +25,7 @@ module.exports = (app) => {
|
|||
});
|
||||
// route to show statistics for spee.ch
|
||||
app.get('/stats', ({ ip, originalUrl }, res) => {
|
||||
sendAnalyticsAndLog(ip, originalUrl);
|
||||
logger.verbose(`POST request on ${originalUrl} from ${ip}`);
|
||||
// get and render the content
|
||||
getStatsSummary()
|
||||
.then(result => {
|
||||
|
@ -46,7 +38,7 @@ module.exports = (app) => {
|
|||
});
|
||||
// route to display all free public claims at a given name
|
||||
app.get('/:name/all', ({ ip, originalUrl, params }, res) => {
|
||||
sendAnalyticsAndLog(ip, originalUrl);
|
||||
logger.verbose(`POST request on ${originalUrl} from ${ip}`);
|
||||
// get and render the content
|
||||
getAllClaims(params.name)
|
||||
.then(orderedFreePublicClaims => {
|
||||
|
|
Loading…
Reference in a new issue