mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-09 17:57:26 +03:00
Replaced Unknown by Direct for traffic comming from undetermined referrers
This commit is contained in:
parent
b89bfa3c1c
commit
96d538db15
3 changed files with 3 additions and 2 deletions
|
@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
#### Changed
|
#### Changed
|
||||||
|
|
||||||
* [#205](https://github.com/shlinkio/shlink-web-client/issues/205) Replaced `jest-each` package by jet's native `test.each` function.
|
* [#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
|
#### Deprecated
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ const updateBrowsersStatsForVisit = (browsersStats, { userAgent }) => {
|
||||||
|
|
||||||
const updateReferrersStatsForVisit = (referrersStats, { referer }) => {
|
const updateReferrersStatsForVisit = (referrersStats, { referer }) => {
|
||||||
const notHasDomain = isNil(referer) || isEmpty(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;
|
referrersStats[domain] = (referrersStats[domain] || 0) + 1;
|
||||||
};
|
};
|
||||||
|
|
|
@ -74,7 +74,7 @@ describe('VisitsParser', () => {
|
||||||
const { referrers } = stats;
|
const { referrers } = stats;
|
||||||
|
|
||||||
expect(referrers).toEqual({
|
expect(referrers).toEqual({
|
||||||
'Unknown': 2,
|
'Direct': 2,
|
||||||
'google.com': 2,
|
'google.com': 2,
|
||||||
'm.facebook.com': 1,
|
'm.facebook.com': 1,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue