bzcomputers
Well-known member
Looking to surround the main Adsense async script with a conditional to allow it to only run if the current template is not included in the the list of "Prevent ads showing in these templates". Currently the way XenForo addresses blocking ads in certain templates does not prevent Adsense "Auto Ads" from showing in these templates. The main Adsense javascript, which is typically referenced outside of any specific ad code block, is the only Adsense code that is required for "Auto Ads" to load, which means "Auto Ads" will show on all templates, which breaks Adsense TOS.
I've seen this code mentioned previously:
and was trying to do something like...
but the above code does not work as I attempted to include it. Any help with that conditional or similar would be appreciated.
I've seen this code mentioned previously:
Code:
in_array($template, $xf.options.adsDisallowedTemplates|split('nl'))
and was trying to do something like...
Code:
<xf:if is="!in_array($template, $xf.options.adsDisallowedTemplates|split('nl'))">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"</script>
</xf:if>
but the above code does not work as I attempted to include it. Any help with that conditional or similar would be appreciated.