From de4a8366fcc239dff8b0eabfbba6768f89b5e144 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Mon, 21 Nov 2016 15:58:29 -0500 Subject: [PATCH] FIX: don't load adsbygoogle.js when adsense publisher id isn't set --- assets/javascripts/discourse/components/google-adsense.js.es6 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/javascripts/discourse/components/google-adsense.js.es6 b/assets/javascripts/discourse/components/google-adsense.js.es6 index 6624e3b..34ae824 100644 --- a/assets/javascripts/discourse/components/google-adsense.js.es6 +++ b/assets/javascripts/discourse/components/google-adsense.js.es6 @@ -24,6 +24,8 @@ function splitHeightInt(value) { // On each page change, the child is removed and elements part of Adsense's googleads are removed/undefined. function changePage() { + if (!Discourse.SiteSettings.adsense_publisher_code) { return; } + const ads = document.getElementById("adsense_loader"); if (ads) { ads.parentNode.removeChild(ads);