Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User agent and language tracking #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ function eventLog(git_application_version) {
})
.send();
}
console.log(req.headers)

res.sendStatus(200)
};
}
Expand All @@ -120,7 +122,7 @@ function pageview() {
// extract page from referer: first get rid of protocol, then get everything after the hostname
const referer = req.get('Referer');
logger.info('pageview referrer', req.body.currentPage, req.body.previousPage || req.body.currentPage);

// if google analytics is configured - if a UA code is provided under the
// configuration property `auth.google.UAId` - then execute the logging through google analytics
if (!!req.visitor) {
Expand All @@ -131,12 +133,13 @@ function pageview() {
const query = path.split('?')[1];
req.visitor.pageview(page, req.hostname, path, {
dl: req.body.currentPage,
dr: req.body.previousPage,
dr: req.body.previousPage || req.headers['referer'],
cs: req.hostname,
cm: 'referral',
ul: req.headers['accept-language'].split(';')[0].split(',')[0],
ua: req.headers['user-agent'],
uip: req.headers['x-forwarded-for'].split(',').pop() || req.connection.remoteAddress || req.socket.remoteAddress
}).send();

// res.sendStatus(200);
}
res.sendStatus(200)
Expand Down