Looking at this banner... At the end of the banner content, we have the following inside a <script> tag:
$(document).ready(function() { [...] /* Hide banner outside of main namespace (and Main Page, for sites where that isn't in main namespace) */ if ( mw.config.get('wgNamespaceNumber') > 0 && !mw.config.get('wgIsMainPage') ) { mw.centralNotice.bannerData.hideResult = true; mw.centralNotice.bannerData.hideReason = 'namespace'; } if (!mw.centralNotice.bannerData.hideResult) { fundraisingBanner.show(); } });
It seems that we need to move the code that sets mw.centralNotice.bannerData outside the $(document).ready() function, so that it runs before alterImpressionData() is called.