From 993958daea8576969dbfe374f10000eb2a4a1942 Mon Sep 17 00:00:00 2001 From: Stuart Taylor Date: Fri, 3 Aug 2018 15:40:55 +0100 Subject: [PATCH] fix(views): Fix view tracking --- news/routes/Show/Show.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/news/routes/Show/Show.js b/news/routes/Show/Show.js index 3d0aec2fa5..f06c36549a 100644 --- a/news/routes/Show/Show.js +++ b/news/routes/Show/Show.js @@ -97,13 +97,13 @@ class ShowArticle extends Component { if (username && !slug) { return history.push('/'); } + const [, shortId] = slug.split('--'); + postPopularityEvent({ + event: 'view', + timestamp: Date.now(), + shortId + }); if (article) { - const [, shortId] = slug.split('--'); - postPopularityEvent({ - event: 'view', - timestamp: Date.now(), - shortId - }); /* eslint-disable react/no-did-mount-set-state */ return this.setState( {