• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Adsense Implementation

#1
Hello,

I'm attempting to implement Adsense on my website, though I'm unsure where I need to put the code provided by Adsense after sign up.

Code:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "ca-pub-XXXXXXXXXXXXXXXX",
    enable_page_level_ads: true
  });
</script>
EDIT: For some odd reason, the forum isn't letting me post, therefore I'll just put what I was going to post here:
Hello @NiallOG, you might find this useful:
https://xenforo.com/community/resources/visual-list-of-ad-locations.1383/
(just add the code in the relevant template)

There are also third party add-ons that can help manage AdSense and other ads.
The code provided is specified to be "Paste it into the HTML of (website URL), right after the <head> tag.". Will it still work in the suggested templates? Also, is the code provided actually for the implementation of the adverts or simply for validation purposes?

Thanks,
Niall
 
Last edited:

Martok

Well-known member
#3
@NiallOG yes, the ad code will work in the templates listed here:

https://xenforo.com/community/resources/visual-list-of-ad-locations.1383/

They were specifically designed to do so.

You may also find this resource useful if you are using Adsense:

https://xenforo.com/community/resources/responsive-adsense.2084/

(check both the overview and the updates tab for details)


If you only wish to display ads to guests and/or some user groups, this resource is also useful:

https://xenforo.com/community/resources/conditional-statements.1604/