How to add Google adsense?

B

bogus

Guest
Hello. I´ve just read about the new ad Templates and now i want to add an adsense Code into ad_above_top_breadcrumb
How do i have to add the Code?
 
R

ragtek

Guest
Hello. I´ve just read about the new ad Templates and now i want to add an adsense Code into ad_above_top_breadcrumb
How do i have to add the Code?
you still need to edit the template;)
 
B

bogus

Guest
Das hilft nicht wirklich ;) Das ich es bearbeiten muss ist mir auch klar

I need to know HOW to add the Code not that i still have to edit the Template...
Do i have to add a new Template and add into ad_above_top_breadcrumb
something like <xen:include template="TEMPLATE NAME" />
Or do i have to add the Code directly into the breadcrump Template and if how?
 

Brogan

XenForo moderator
Staff member
Paste the Google Adsense code directly into the ad_ template.

For example:
Code:
<xen:if is="{$quickNavSelected} != 'node-55'">
    <xen:if is="!{xen:helper ismemberof, $visitor, 3} AND !{xen:helper ismemberof, $visitor, 4} AND !{xen:helper ismemberof, $visitor, 5} AND !{xen:helper ismemberof, $visitor, 6} AND !{xen:helper ismemberof, $visitor, 7}">
        <div style="text-align: center">
            <script type="text/javascript"><!--
            google_ad_client = "your-adsense-id";
            /* Banner Narrow (Above Upper Breadcrumb) */
            google_ad_slot = "4545463";
            google_ad_width = 468;
            google_ad_height = 60;
            //-->
            </script>
            <script type="text/javascript"
            src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
            </script>
        </div>
    </xen:if>
</xen:if>
In the example above I have a few conditionals to stop adverts being displayed on a Page node (55) and to 5 user groups.
 
B

bogus

Guest
Thanks Brogan.
If i want to display it for eveyone without any conditionals i also could just use
Code:
        <div style="text-align: center">
            <script type="text/javascript"><!--
            google_ad_client = "your-adsense-id";
            /* Banner Narrow (Above Upper Breadcrumb) */
            google_ad_slot = "4545463";
            google_ad_width = 468;
            google_ad_height = 60;
            //-->
            </script>
            <script type="text/javascript"
            src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
            </script>
        </div>
 
Paste the Google Adsense code directly into the ad_ template.

For example:
Code:
<xen:if is="{$quickNavSelected} != 'node-55'">
    <xen:if is="!{xen:helper ismemberof, $visitor, 3} AND !{xen:helper ismemberof, $visitor, 4} AND !{xen:helper ismemberof, $visitor, 5} AND !{xen:helper ismemberof, $visitor, 6} AND !{xen:helper ismemberof, $visitor, 7}">
        <div style="text-align: center">
            <script type="text/javascript"><!--
            google_ad_client = "your-adsense-id";
            /* Banner Narrow (Above Upper Breadcrumb) */
            google_ad_slot = "4545463";
            google_ad_width = 468;
            google_ad_height = 60;
            //-->
            </script>
            <script type="text/javascript"
            src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
            </script>
        </div>
    </xen:if>
</xen:if>
In the example above I have a few conditionals to stop adverts being displayed on a Page node (55) and to 5 user groups.
How do i go about making it so it doesnt show in the threads, but only in the nodes?
 

Brogan

XenForo moderator
Staff member
I'm not sure what you mean by the nodes, but just search the templates for everything beginning ad_ and use the appropriate one.
 

kingston

Well-known member
Try ad_thread_list_below_stickies
Brogan,

I can't seem to get my ads to line up on the left. Any Ideas?

Here is an example page: http://forum.fierceboard.com/threads/small-junior-4.17936/

Here is my code to insider the ad:

HTML:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{xen:helper ismemberof, $visitor, 20} AND !{$message.conversation_id}">
<li class="message">

        <div class="messageUserInfo"></div>

        <div class="messageInfo primaryContent">
            <div class="messageContent" >
                <blockquote class="messageText ugc baseHtml" >
<div style="text-align: left">
<script type="text/javascript"><!--
google_ad_client = "***********";
google_ad_slot = "*********";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
              </blockquote>
            </div>
        </div>
    </li>
</xen:if>
 

Brogan

XenForo moderator
Staff member
You're using the messageInfo class which has a 140px left margin.

Why are you using all of those classes?

Just place the ad code in the template.
 

kingston

Well-known member
You're using the messageInfo class which has a 140px left margin.

Why are you using all of those classes?

Just place the ad code in the template.
No idea. I think I copied it from someone earlier on here. Silly legacy code and me not knowing what I am doing. Thanks for the help. Fixed it.
 
Top