• Welcome to XF2 Addons. All the XF2 addons located in the Resources area are available for download once you upgrade your account to Premium membership. In addition, Premium members will get technical support. Premium membership costs only $25.00 USD a year. Once the year has expired you can continue to use the installed addons on your forum as long as you like.

Advertising - How to add your Google AdSense

Andy

Administrator
Staff member
#1
I suggest putting your Adsense in the thread view, one on the top and one on the bottom.

pic001.jpg

Example:

1) Go to the Advertising option:

Admin control panel -> Setup -> Advertising

2) Click the Add advertisement button.

Title
AdSense - Container breadcrumb (top): Above

Position
Container breadcrumb (top): Above

HTML
Code:
<xf:if is="{$xf.reply.template} == 'thread_view'">
    <center>
    <div style="max-width:728px;margin:6px;">
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- Responsive -->
    <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>
    </center>
</xf:if>
Display criteria
Registered
Unregistered / Unconfirmed

3) Save

4) Do the same steps for the AdSense to show at the bottom.
 

Andy

Administrator
Staff member
#2
Q: Why place AdSense only on thread view?
A: 95% of views on a forum will be the thread view, so there's very little gain in placing the AdSense anywhere else.