From fb9f6e118ef349e89e0219ba2e9395f7a5a2dd9f Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Sun, 25 Mar 2018 22:23:10 +0300 Subject: [PATCH] Catch error on Google Analytics loading --- src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 60096ef..f6f1251 100644 --- a/src/index.js +++ b/src/index.js @@ -65,7 +65,8 @@ function initAnalytics() { if (window.GA_ID) { // when GA is not available, we will continue to push into array // for debug purposes - loadScript('https://www.google-analytics.com/analytics.js'); + // Catch to prevent "unhandled rejection" error + loadScript('https://www.google-analytics.com/analytics.js').catch(() => {}); } ga('create', window.GA_ID, 'auto');