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.
This commit is contained in:
Benedict Aas 2018-02-14 12:03:40 +00:00 committed by GitHub
parent de4f9e4257
commit 34b4f65c20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -190,12 +190,17 @@ class SafeWebview extends react.PureComponent {
* @param {Event} event - Event object * @param {Event} event - Event object
*/ */
didGetResponseDetails (event) { didGetResponseDetails (event) {
const HTTP_OK = 200 // This seems to pick up all requests related to the webview,
const HTTP_ERR = 400 // only care about this event if it's a request for the main frame
if (event.resourceType === 'mainFrame') {
const HTTP_OK = 200
this.setState({ analytics.logEvent(event)
shouldShow: event.httpResponseCode >= HTTP_OK && event.httpResponseCode < HTTP_ERR
}) this.setState({
shouldShow: event.httpResponseCode === HTTP_OK
})
}
} }
/** /**