Add AdSense to the Google Trace Code Manager

 If you want to use Google Tracking Code Manager to deliver AdSense, I can also use other ads from other sources. I found that the answers from each site were few, but not enough to understand. If it is possible to use the AdSense code in GTM, enter the input here, and if so, how? I also use a DFP AD management system. What if I had to use a DFP AD management system?

Say you have Google Tracker Code Manager (GTM) running on your site?

1. In the GTM workspace, click the variable on the left side of the screen

2. Create a new user-defined variable and name it ClientID

3. Configure variables as constants. The value entered is your AdSense customer ID

4. In your GTM workspace, click the TAB on the left side of the screen

5. Create a new TAB named AS - Page View - All

6. Since there is no built-in markup in AdSense's GTM, you need to use the "custom HTML" markup.

7. Copy and paste the HTML code shown below into GTM.

8. Select the "All Pages" view of the trigger

9. Test if your changes are stale in preview mode

10. When all is well, publish the changes to Live.

 <script async src="//"></script>
  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "{{asClientID}}",
    enable_page_level_ads: true

As you can see, we are using {{asClientID}} in the script we created in steps 1 and 2. The reason for creating this variable is flexibility. If you need to change the ID, you can do it in a variable rather than in code.

Note: Implementing AdSense through GTM is not the best practice.

I hope this is what you want. Please let me know if it suits you.

Post a Comment