Responsive AdSense

Responsive AdSense

I've taken a look at the Conditional Statements but couldn't find one that tells how to add an Ad after the first unread message.

Could anyone please tell me how to do that?
 
I just wanted to clarify about the beta responsive ad units.

Say I currently have 3 ad units on a page (2 banners and 1 square). Would I create 3 responsive ad units all called something different or would I just have 1 unit and use the CSS to control it's size/shape?
 
I would like to show different ads to guests and logged in members, but I would also like to hide ads to usergroups 3, 4, 14 and 16.

I found this, but I don't really know what to do to include that usergroup exception.
Could somebody please help me?


Code:
How can I show different content to guests and logged in members?
<xen:if is="{$visitor.user_id}">
This content will show to logged in members
<xen:else />
This content will show to guests
</xen:if>
 
If you want to keep it simple, just use that as the outer conditional statement and wrap the other code in it.

Or you can combing statements using AND and OR.

It's up to you which approach you take.
 
Hi Brogan -

Any ideas how to modify the new Google responsive adsense to only show if the document width is greater than 400px? I would like to stop using 'display:none' to stay within TOS.

Code:
<xen:hook name="ad_below_top_breadcrumb" />
<xen:if is="{$contentTemplate} == 'thread_view' OR {$contentTemplate} == 'forum_view'">
<div class="adsense">
<style>
.top-responsive { width: 320px; height: 50px; }
@media(min-width: 500px) { .top-responsive { width: 468px; height: 60px; } }
@media(min-width: 800px) { .top-responsive { width: 728px; height: 90px; } }
</style>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Top Responsive -->
<ins class="adsbygoogle top-responsive"
     style="display:inline-block"
     data-ad-client="ca-pub-1234"
     data-ad-slot="8948558153"
     data-ad-format="horizontal"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</xen:if>
 
Any examples out there to get me started?
Otherwise, I may switch it back to the normal adsense and use your code.
 
Code:
<xen:hook name="ad_message_body" />

<style type="text/css">
.message-body-dynamic {
width: 125px;
height: 125px;
}

@media(min-width: 360px) {
    .message-body-dynamic {
    width: 180px;
    height: 150px;
    }
}

@media(min-width: 640px) {
    .message-body-dynamic {
    width: 300px;
    height: 250px;
    }
}
</style>

<xen:if is="!{$visitor.user_id}">
    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0">
        <xen:if is="@enableResponsive">
            <div style="min-height: 125px; margin-left: 8px; float: right">
                <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                <!-- Message Body - Dynamic -->
                <ins class="adsbygoogle message-body-dynamic"
                     style="display:inline-block"
                     data-ad-client="ca-pub-1234567890"
                     data-ad-slot="123456"></ins>
                <script>
                (adsbygoogle = window.adsbygoogle || []).push({});
                </script>
            </div>
        <xen:else />
            <div style="min-height: 125px; margin-left: 8px; float: right">
                <script type="text/javascript">
                google_ad_client = "ca-pub-1234567890";
                /* Message Body */
                google_ad_slot = "654321";
                google_ad_width = 300;
                google_ad_height = 250;
                </script>
                <script type="text/javascript"
                src="//pagead2.googlesyndication.com/pagead/show_ads.js">
                </script>
            </div>
        </xen:if>
    </xen:if>
</xen:if>

You will need to create the ads and either use the same class names or edit to suit.
 
It works, but i have 3 ads created:

1. 125x125
2. 180x150
3. 300x250

and in the code there are only 2 ad-slots? Which should i take, and what´s with the third?
 
The code uses a mixture of responsive and regular AdSense.

You may want to read the resource to understand how it works.
 
Ok i have to create only an responsive ad unit instead of the 3 sizes?
Now the 2 ad slots from the responsive Code (synchronos and asynchronos) are the same? Is that right?

Or what did you mean by "regular ad slot."?

Or do i have to create an responsive ad unit and a normal 300x250 ad unit?

Sorry i am total confused. :confused:

Do you have an idea to fix the error with the quote Box like you can see here?

http://www.soccer-fans.de/forum/threads/wm-halbfinale-brasilien-deutschland-08-07-2014.57214/page-6
 
You need one asynchronous ad slot for the asynchronous code and one regular ad slot for the regular code.
Note that the ad ID is different for each one, to highlight that fact.

Asynchronus, responsive = orange
Regular, non-responsive = green
Rich (BB code):
<xen:if is="!{$visitor.user_id}">
    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0">
        <xen:if is="@enableResponsive">
            <div style="min-height: 125px; margin-left: 8px; float: right">
                <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                <!-- Message Body - Dynamic -->
                <ins class="adsbygoogle message-body-dynamic"
                     style="display:inline-block"
                     data-ad-client="ca-pub-1234567890"
                     data-ad-slot="123456"></ins>
                <script>
                (adsbygoogle = window.adsbygoogle || []).push({});
                </script>
            </div>
        <xen:else />
            <div style="min-height: 125px; margin-left: 8px; float: right">
                <script type="text/javascript">
                google_ad_client = "ca-pub-1234567890";
                /* Message Body */
                google_ad_slot = "654321";
                google_ad_width = 300;
                google_ad_height = 250;
                </script>
                <script type="text/javascript"
                src="//pagead2.googlesyndication.com/pagead/show_ads.js">
                </script>
            </div>
        </xen:if>
    </xen:if>
</xen:if>

Your Style Properties are out of date.
Overflow:auto was added to the various bb code elements a long time ago to resolve that.
 
Back
Top Bottom