From 96d538db156466152cef7f375c48ffb487765d02 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 6 Mar 2020 20:42:22 +0100 Subject: [PATCH] Replaced Unknown by Direct for traffic comming from undetermined referrers --- CHANGELOG.md | 1 + src/visits/services/VisitsParser.js | 2 +- test/visits/services/VisitsParser.test.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d51bf867..e6581ab7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/visits/services/VisitsParser.js b/src/visits/services/VisitsParser.js index 8aef797f..004f8e30 100644 --- a/src/visits/services/VisitsParser.js +++ b/src/visits/services/VisitsParser.js @@ -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; }; diff --git a/test/visits/services/VisitsParser.test.js b/test/visits/services/VisitsParser.test.js index c6dfd717..01041e53 100644 --- a/test/visits/services/VisitsParser.test.js +++ b/test/visits/services/VisitsParser.test.js @@ -74,7 +74,7 @@ describe('VisitsParser', () => { const { referrers } = stats; expect(referrers).toEqual({ - 'Unknown': 2, + 'Direct': 2, 'google.com': 2, 'm.facebook.com': 1, });