XF 2.1 AdSense

DaveM

Well-known member
I am busy signing up for Google AdSense but now I need to take this code and past it into my header as per the steps below, I have no idea how to do this however?



Connect your site to AdSense
It's as easy as copying and pasting.

  • 1 Copy the code below
  • 2 Paste it into the HTML of https://triumphtalk.com, between the <head> and </head> tags
  • 3 Check the box and click done when you finish
Code:
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "ca-pub-5280728462676477",
    enable_page_level_ads: true
  });
</script>
 
Edit your style's PAGE_CONTAINER template and add that right before the close of the tag, </head>.

Then, if you haven't already, upload your ads.txt file to complete the steps. If already approved, ads should start appearing within 20 minutes. If not, up to a couple days.
 
There's no need to do this, the Advertisements in the ACP automatically do this for you.
What position is that? Container header?

I ask cause mine is in PAGE_HEADER and excluded from showing to some user groups. If the position is the same, that'd cut down on some of my conditionals. Thanks!
 
What position is that? Container header?
Any position (so yes, container header is included). The Adverts system was designed so that you can simply put in your code in to the ad positions you create in the ACP and that will then ensure any code appears in the correct position (ie in this case, in between the <head> tags) and there's no need to insert the code directly into the PAGE_HEADER template. In addition, you can control with the Adverts system exactly who sees the ads, whether that be guests only and/or certain user groups. On my site guests and newly registered users see the adverts but longer term members do not.
 
Any position (so yes, container header is included). The Adverts system was designed so that you can simply put in your code in to the ad positions you create in the ACP and that will then ensure any code appears in the correct position (ie in this case, in between the <head> tags) and there's no need to insert the code directly into the PAGE_HEADER template. In addition, you can control with the Adverts system exactly who sees the ads, whether that be guests only and/or certain user groups. On my site guests and newly registered users see the adverts but longer term members do not.
Hello, so we only need to create a position for Container header and add the verification code into it, right ? :unsure:

Regards, SyTry
 
Top Bottom