diff --git a/CHANGELOG.md b/CHANGELOG.md index 56d584273e..4e296639d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,8 +14,17 @@ way to update this template, but currently, we follow a pattern: ## Upcoming version 2022-XX-XX +## [v8.6.1] 2022-05-19 + +- [fix] undefined REACT_APP_GOOGLE_ANALYTICS_ID caused an error. + [#1516](https://github.com/sharetribe/ftw-daily/pull/1516) + + [v8.6.1]: https://github.com/sharetribe/ftw-daily/compare/v8.6.0...v8.6.1 + ## [v8.6.0] 2022-05-19 +Note: this caused an error. Use v8.6.1 instead. + - [change] Google Analytics: remove Universal Analytics and start supporting GA4. NOTE: you need to update the Google Analytics id to GA4's id (starting with 'G-' prefix). diff --git a/server/renderer.js b/server/renderer.js index 88c4687f16..88681925e0 100644 --- a/server/renderer.js +++ b/server/renderer.js @@ -129,7 +129,7 @@ exports.render = function(requestUrl, context, data, renderApp, webExtractor) { // See: https://developers.google.com/analytics/devguides/collection/gtagjs const googleAnalyticsId = process.env.REACT_APP_GOOGLE_ANALYTICS_ID; // Add Google Analytics script if correct id exists (it should start with 'G-' prefix) - const hasGoogleAnalyticsv4Id = googleAnalyticsId.indexOf('G-') === 0; + const hasGoogleAnalyticsv4Id = googleAnalyticsId?.indexOf('G-') === 0; // Google Analytics: gtag.js // NOTE: FTW is a single-page application (SPA).