XF 1.2 I want to put adsense on my site.

I am new to this and my adsense acount is not fully active, but they want me to add the code snippit before I can be fully approved.
I created a responsive ad slot using google adsense and open the template Below Top Breadcrumb,
and pasted the code from google there.
this has created a blank place holder which is correct I think as I am not yet approved?

so my questions are
1. Have I done the first part correct?
2. How can I make it so that only guests see the ad? (the placeholder is present even for admin).

hope someone can help me out!

thanks in advance
 
oh and here is the code i used!
Code:
<xen:hook name="ad_below_top_breadcrumb" />
<style>
.guest-ads-top { width: 320px; height: 50px; }
@media(min-width: 500px) { .guest-ads-top { width: 468px; height: 60px; } }
@media(min-width: 800px) { .guest-ads-top { width: 728px; height: 90px; } }
</style>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Guest  Ads Top -->
<ins class="adsbygoogle guest-ads-top"
    style="display:inline-block"
    data-ad-client="ca-pub-7863887970724476"
    data-ad-slot="1618849548"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
 
Use a conditional statement to show it to guests only.

My signature has a link to a resource for that.
I have also written an AdSense resource.
 
thanks I will bookmark that.....but if you dont mind as I have only been at this a week!!!

is this correct?

Code:
<xen:hook name="ad_below_top_breadcrumb" />
<xen:if is="!{$visitor.user_id}">
<style>
.guest-ads-top { width: 320px; height: 50px; }
@media(min-width: 500px) { .guest-ads-top { width: 468px; height: 60px; } }
@media(min-width: 800px) { .guest-ads-top { width: 728px; height: 90px; } }
</style>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Guest  Ads Top -->
<ins class="adsbygoogle guest-ads-top"
    style="display:inline-block"
    data-ad-client="ca-pub-7863887970724476"
    data-ad-slot="1618849548"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</xen:if>
 
that code did not work!!! it was putting <xen:hook name="ad_below_top_breadcrumb" /> in the slot so i did this and it seems to be working!
I just hope I have not done something that will stop google being able to pipe the ads in!!!

Code:
<xen:comment>
<xen:hook name="ad_below_top_breadcrumb" />
</xen:comment>
<xen:if is="!{$visitor.user_id}">
<style>
.guest-ads-top { width: 320px; height: 50px; }
@media(min-width: 500px) { .guest-ads-top { width: 468px; height: 60px; } }
@media(min-width: 800px) { .guest-ads-top { width: 728px; height: 90px; } }
</style>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Guest  Ads Top -->
<ins class="adsbygoogle guest-ads-top"
    style="display:inline-block"
    data-ad-client="ca-pub-7863887970724476"
    data-ad-slot="1618849548"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</xen:if>
 
You can see if the code is correct by using a browser inspection tool.

But yes, it can take an hour or so for ads to start being served.
 
Back
Top Bottom