Replaced Unknown by Direct for traffic comming from undetermined referrers

This commit is contained in:
Alejandro Celaya 2020-03-06 20:42:22 +01:00
parent b89bfa3c1c
commit 96d538db15
3 changed files with 3 additions and 2 deletions

View file

@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
#### Changed
* [#205](https://github.com/shlinkio/shlink-web-client/issues/205) Replaced `jest-each` package by jet's native `test.each` function.
* [#209](https://github.com/shlinkio/shlink-web-client/issues/209) Replaced `Unknown` by `Direct` for visits from undetermined referrers.
#### Deprecated

View file

@ -61,7 +61,7 @@ const updateBrowsersStatsForVisit = (browsersStats, { userAgent }) => {
const updateReferrersStatsForVisit = (referrersStats, { referer }) => {
const notHasDomain = isNil(referer) || isEmpty(referer);
const domain = notHasDomain ? 'Unknown' : extractDomain(referer);
const domain = notHasDomain ? 'Direct' : extractDomain(referer);
referrersStats[domain] = (referrersStats[domain] || 0) + 1;
};

View file

@ -74,7 +74,7 @@ describe('VisitsParser', () => {
const { referrers } = stats;
expect(referrers).toEqual({
'Unknown': 2,
'Direct': 2,
'google.com': 2,
'm.facebook.com': 1,
});