I tried and found the way to add Google Auto Ads to Discourse via Google Tag Manager.
-
Login to Google Tag Manager: https://tagmanager.google.com/#/home, Choose Workspace
-
Create a new user defined variable and call it asClientID
- Configure the variable as a Constant. The value to enter is your AdSense Client ID
-
Click on Tags on the left side of the screen within your GTM workspace
-
Create a new Tag called AS - Page view - ALL
Tag Type: Custom HTML
Copy this code to HTML:
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "{{asClientID}}",
enable_page_level_ads: true
});
</script>
Triggering choose All Pages
Preview and Publish.
- Get GTM ID
- In Admin β Settings β Search GTM and paste GTM ID, confirm.
You can check in my website at https://babyforex.net.
Hope help you!