times You can try the following. I have not been able to test it well, but it may work. Use this code with your parameters before the </head>, you can use this extension: https://discuss.flarum.org/d/25907-html-head-items
<script type="text/javascript">
// Carga el script de AdSense
const script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-0000000000000001';
script.async = true;
script.crossorigin = 'anonymous';
document.head.appendChild(script);
// Espera a que el script se cargue y muestre el anuncio en el contenedor
script.onload = function() {
const adContainer = document.getElementById('ad-container');
if (adContainer) {
adContainer.innerHTML = '<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-0000000000000001" data-ad-slot="0000000002" data-ad-format="auto" data-full-width-responsive="true"></ins>';
(adsbygoogle = window.adsbygoogle || []).push({});
}
};
</script>
Then include this in the HTML block where you want to display your code:
<div id="ad-container"></div>
mueenulit Sorry for the delay in responding to this, but maybe it will help other visitors. For Ads Terra, this is what works for me if I use Native Banner.
Place the script in the header with the extension: https://discuss.flarum.org/d/25907-html-head-items Like This
<script async="async" data-cfasync="false" src="//pl19047007.highrevenuegate.com/YOUR-ID/invoke.js"></script>
In the HTML part place just the ID code, similar to this:
<div id="container-YOUR-ID"></div>
Edit: @davwheat Maybe it would be interesting to use this as part of a help guide in the main post for new users to avoid redundant questions.