diff --git a/server/google-analytics.js b/server/google-analytics.js
index b98ca8623..fc9fbec84 100644
--- a/server/google-analytics.js
+++ b/server/google-analytics.js
@@ -8,6 +8,11 @@ const jsesc = require("jsesc");
*/
function getGoogleAnalyticsScript(tagId) {
let escapedTagId = jsesc(tagId, { isScriptContext: true });
+
+ if (escapedTagId) {
+ escapedTagId = escapedTagId.trim();
+ }
+
return `