• Welcome to XF2 Addons. You can buy my Premium membership for $35 per year, and this gives you access to download any or ALL of the 300 add-ons that I have developed for Xenforo 2.x. In addition, Premium members will get technical support. Once the Premium membership has expired you can continue to use the installed addons on your forum as long as you like.

How to add AdSense to the header


Andy

Administrator
Staff member
Here are steps to add AdSense to your header:

1) Admin control panel -> Setup -> Advertising -> Add advertisement

2) Do the following:

Title = AdSense - Container header

Position = Container header

HTML =

HTML:
<div style="width:500px;">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Responsive 08/24/16 -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-123456789"
     data-ad-slot="123456789"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
Display criteria = Unregistered /Unconfirmed and Registered

Display order = 0
 

Andy

Administrator
Staff member
Upon further testing of these instructions, placing your AdSense in the header is not a good way to go. The smaller size ads will earn less revenue. Also I think it looks nicer to not have an AdSense in the header, I prefer further down the page.
 

Russ

Well-Known Member
Upon further testing of these instructions, placing your AdSense in the header is not a good way to go. The smaller size ads will earn less revenue. Also I think it looks nicer to not have an AdSense in the header, I prefer further down the page.
Thanks again for reminding me of the needed div. Setting Style=width:100% will allow Google to dynamically place various ad sizes to maximize revenue.
 

Andy

Administrator
Staff member
The problem is you really can't use a div larger than 500px because on medium sized devices like tablets the AdSense will be shown on a new line. Smaller AdSense ads which are 500px earn less revenue.
 

Russ

Well-Known Member
The problem is you really can't use a div larger than 500px because on medium sized devices like tablets the AdSense will be shown on a new line. Smaller AdSense ads which are 500px earn less revenue.
New line is expected/desired for me. A bigger problem is Container header is not responsive, so will simply not show on smaller devices.
 
Similar threads
Thread starter Title Forum Replies Date
Andy Find member add-on has been deleted General 0
D [Add-On Request] Quick Forum Jump Widget General 0
gerryvz Idea for Chat add-on General 2
C Add Prefix to Advanced Search Addon General 0
kensonplays [Add-On Request] Stop From Posting Against Word Censor General 0
Andy Add to Home Screen General 2
C Feature Request: Member Search add-on General 1
420 Do the following add-ons work with XF 2.1? General 8
D [Request] Add Option for Auto delete email confirm General 7
X Suggestion new Add-on to Send Email General 0
Robru [suggestion] add-ons for XF2.1 General 1
X Suggestion Add Template to threads General 0
X new suggestion for a new add-on General 6
D How to add post thread button General 0
N Suggestion for duplicate user add-on General 1
A Bug with the add-on New posts live General 0
BassMan [Version check] XF1 and XF2 add-ons showing on XF2 forum General 20
A add-on Video General 10
S Suggestions for the "Quick search" add-on General 1
S A few improvement requests for "Inactive members" Add-On General 1
BassMan [Calendar] Add new line General 30
A Auto delete and Auto move add-ons General 0
A [Suggestion] Featured posts add-on, maximum height General 5
rsi Remove Hide Add-0n General 8
S How To add This font-family ni Xenforo 2 General 4
S How To add This font-family ni General 1
S Add-on Suggestion: Alert admin if a link is added to an existing post by a new member General 1
rsi Robots add-on General 16
E Suggestion: Trader: add trader profile to "Message user info elements" General 10
pilou suggestion add-ons : Sticky Thread Order General 2
P Add-on suggestion - Thread of the day General 5
S Addon Suggestion: Add member X to member Y's ignore list General 4
P Thread Starter Reminder Add-on General 9
pilou create translations for add-ons? General 1
S Possible feature request about Change author add-on General 5
Mark87 Fake users Add On ? General 19
D Add Members in last 24 hours to Forum Statistics Plus ? General 4
P Add Font Awesome For Conversation View General 4
P rotate_imagemagick_pecl_extension_not_enabled error on Rotate add-on General 2
Gator [Add-on Request] User Upgrade Listing General 8
Andy Correct directory location for add-ons General 0
T Google custom search add-on question General 3
T Custom Thread Field Filter Add-on request General 7
T Quick Deal button Add-on request General 4
Andy How to change or add Calendar holidays? General 0
Andy How to add an Font Awesome to a link General 0
Gator [Suggestion] Add "Featured Thread(s)" Widget General 0
S Bookmark Add On General 8
S History Add On and Pagination General 7
Andy Audio add-on download button in Chrome General 1

Similar threads

Top