From 34b4f65c207d720e8251e6c39e2e71aaa43f5e03 Mon Sep 17 00:00:00 2001 From: Benedict Aas Date: Wed, 14 Feb 2018 12:03:40 +0000 Subject: [PATCH] feat: log the event status of the banner (#2013) We add log the banner HTTP load event object to the analytics. Change-Type: patch Changelog-Entry: Log the banner load event to analytics. --- lib/gui/app/components/safe-webview.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/gui/app/components/safe-webview.js b/lib/gui/app/components/safe-webview.js index 9b457190..534a422e 100644 --- a/lib/gui/app/components/safe-webview.js +++ b/lib/gui/app/components/safe-webview.js @@ -190,12 +190,17 @@ class SafeWebview extends react.PureComponent { * @param {Event} event - Event object */ didGetResponseDetails (event) { - const HTTP_OK = 200 - const HTTP_ERR = 400 + // This seems to pick up all requests related to the webview, + // only care about this event if it's a request for the main frame + if (event.resourceType === 'mainFrame') { + const HTTP_OK = 200 - this.setState({ - shouldShow: event.httpResponseCode >= HTTP_OK && event.httpResponseCode < HTTP_ERR - }) + analytics.logEvent(event) + + this.setState({ + shouldShow: event.httpResponseCode === HTTP_OK + }) + } } /**