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

XF 1.4 Another Adsense question

#1
There are lots of posts about adding adsense to your forum......and I read them all. I thought I can figure it out. After 2 weeks of researching I got nothing. I tired everything. I even looked at other Xenforo forums (source) and used the same formulas. I used IE and Chrome. Can anyone please help me? Here is my site:

http://galah.arvixe.com/~jerzy13/index.php

I greatly appreciate all your help and comments.

Thank you,
 

Martok

Well-known member
#7
How long have you had the code in place? It sometimes can take a little while for adverts to start displaying.

I suggest you go into a lot more detail than that - what ad templates you have edited, the code you have added, whether you have tried to add some responsive code too. Saying the ads aren't showing isn't a lot to go on.
 
#8
Here we go........

This is what I have in ad_above_content

<xen:hook name="ad_above_content" />

<xen:if is="!in_array({$contentTemplate}, array('', 'message_page', 'error', 'search_form', 'search_form_post', 'search_form_profile_post', 'search_results', 'register_form', 'login', 'error_with_login', 'contact'))">

<div class=”section”></div>
<div class=”secondaryContent”></div>
<div style=”text-align: center; margin-top:8px;”></div>

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- above_top_breadcrumb res -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-xxxxxxxxxxxx"
data-ad-slot="xxxxxxxxx"
data-ad-format="auto"></ins>
<script>

(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</xen:if>
 
#9
In above_top_breadcrumb........

<xen:hook name="ad_above_top_breadcrumb" />
<style type="text/css">
.above-top-breadcrumb-with-sidebar-dynamic {
width: 234px;
height: 60px;
}
@media(min-width: 346px) {
.above-top-breadcrumb-with-sidebar-dynamic {
width: 320px;
height: 50px;
}
}
@media(min-width: 494px) {
.above-top-breadcrumb-with-sidebar-dynamic {
width: 468px;
height: 60px;
}
}
.above-top-breadcrumb-no-sidebar-dynamic {
width: 234px;
height: 60px;
}
@media(min-width: 346px) {
.above-top-breadcrumb-no-sidebar-dynamic {
width: 320px;
height: 50px;
}
}
@media(min-width: 494px) {
.above-top-breadcrumb-no-sidebar-dynamic {
width: 468px;
height: 60px;
}
}
@media(min-width: 754px) {
.above-top-breadcrumb-no-sidebar-dynamic {
width: 728px;
height: 90px;
}
}
</style>
<xen:if is="!{$visitor.user_id}">
<xen:if is="!in_array({$contentTemplate}, array('', 'message_page', 'error', 'search_form', 'search_form_post', 'search_form_profile_post', 'search_results', 'register_form', 'register_facebook', 'register_twitter', 'register_google', 'login', 'error_with_login', 'contact', 'thread_view', 'cta_overtaking_index'))">
<xen:if is="@enableResponsive">
<xen:if is="{$sidebar}">
<div style="text-align: center; padding: 8px 0">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- above_top_breadcrumb res -->
<ins class="adsbygoogle"
style="display:inline-block"
data-ad-client="ca-pub-0xxxxxxxxx"
data-ad-slot="xxxxxxxxxx"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<xen:else />
<div style="text-align: center; padding: 8px 0">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- above_top_breadcrumb res -->
<ins class="adsbygoogle"
style="display:inline-block"
data-ad-client="ca-pub-xxxxxxxxx"
data-ad-slot="xxxxxxxx"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</xen:if>
<xen:else />
<xen:if is="{$sidebar}">
<div style="text-align: center; padding: 8px 0">
<script type="text/javascript">
google_ad_client = "ca-pub-xxxxxxxxx";
/* Below Top Breadcrumb Narrow */
google_ad_slot = "xxxxxxxx";
google_ad_width = 468;
google_ad_height = 60;
</script>
<script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
</div>
<xen:else />
<div style="text-align: center; padding: 8px 0">
<script type="text/javascript">
google_ad_client = "ca-pub-xxxxxxxxxxx";
/* Below Top Breadcrumb Wide */
google_ad_slot = "xxxxx";
google_ad_width = 728;
google_ad_height = 90;
</script>
<script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
</div>
</xen:if>
</xen:if>
</xen:if>
</xen:if>
 
#10
Below content ......


<xen:hook name="ad_below_content" />

<div class=”section”>
<div class=”secondaryContent”>
<div style=”text-align: left; margin-top:8px;”>
<script type="text/javascript">
google_ad_client = "ca-pub-xxxxxxx";
google_ad_slot = "4413784255";
google_ad_width = 468;
google_ad_height = 15;
</script>
<!-- new test -->
<script type="text/javascript"
src="//pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div></div>
 
#11
Message below ....

<xen:hook name="ad_message_below" />

<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$thread.reply_count} > 0">
<xen:if is="!{$visitor.user_id}">
<li class="message">
<div class="messageUserInfo" itemscope="itemscope" itemtype="http://data-vocabulary.org/Person">
<div class="messageUserBlock">
<div class="avatarHolder">
<span class="helper"></span>
<xen:avatar user="$visitor" size="m" img="true" />
</div>
<h3 class="userText">
<span style="font-weight: bold">Google AdSense</span>
<em class="userTitle" itemprop="title">Guest Advertisement</em>
</h3>
<span class="arrow"><span></span></span>
</div>
</div>
<div class="messageInfo primaryContent">
<div class="messageContent">
<article>
<blockquote class="messageText ugc baseHtml">
<script type="text/javascript">
google_ad_client = "ca-pub-xxx";
width = document.documentElement.clientWidth;
/* Message Below Responsive 2 */
google_ad_slot = "xxxxx";
google_ad_width = 320;
google_ad_height = 50;
if (width > 619) {
/* Message Below Responsive 1 */
google_ad_slot = "xxxxxx";
google_ad_width = 468;
google_ad_height = 60;
}
if (width > 879) {
/* Message Below */
google_ad_slot = "xxxxxxx";
google_ad_width = 728;
google_ad_height = 90;
}
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br /><br /><label for="LoginControl"><span style="font-weight: bold; color: #004400"><a href="login/" class="concealed noOutline">Log in or Sign up</a></span></label> to hide all adverts.
</blockquote>
</article>
</div>
</div>
</li>
</xen:if>
</xen:if>
 

Martok

Well-known member
#12
I've only looked at the first one and I can't see anything obvious that's wrong, apart from this:

Code:
<div class=”section”></div>
<div class=”secondaryContent”></div>
<div style=”text-align: center; margin-top:8px;”></div>
You should be using plain double quotes, not rich text ones i.e. use " not ”.

In addition, you've not answered this:

How long have you had the code in place? It sometimes can take a little while for adverts to start displaying.
 
#13
I have had these codes for a week...... As I said, I would never bother anyone unless I tried everything that was posted on this forum.
 
#15
I did. This is what I have now.....(still no ads)

<xen:hook name="ad_above_content" />
<xen:if is="!in_array({$contentTemplate}, array('', 'message_page', 'error', 'search_form', 'search_form_post', 'search_form_profile_post', 'search_results', 'register_form', 'login', 'error_with_login', 'contact'))">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- above_top_breadcrumb res -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-1234567890"
data-ad-slot="123456"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</xen:if>
 

Martok

Well-known member
#16
I did. This is what I have now.....(still no ads)
Yes and assuming that was the error that has caused the problems and prevented any adverts being shown, you'll now have to wait a little while until adverts are served.

BTW, I'm assuming that the google_ad_client = "ca-pub-xxxxxxxxx" and google_ad_slot = "xxxxxxxx" etc is you removing the correct code before pasting here in the forums and you haven't actually pasted that into your templates...
 
#17
Yes, I place the correct codes (copy and paste from my adsense account, "xxxxx" was just masking my client id..... I don't even know why I tried to mask it. Everyone can see it in View --> Source :)))

Martok, I want to thank you for you help. It didn't work but at least we tried. I guess I will have to live without Adsense