Responsive AdSense

Responsive AdSense

Brogan updated Responsive AdSense with a new update entry:

Commonly requested uses and placements

This guide will list some of the most commonly requested uses and placements.

For ease of understanding, the following examples mainly involve using single conditional statements only, although there are some more complex examples towards the end.

In order to combine statements, you can nest them, with each statement on its own line, like so:
Code:
<xen:if is="!{$visitor.user_id}">
    <xen:if is="{$contentTemplate} == 'template'">
        Ad code
    </xen:if>
</xen:if>

Or join...

Read the rest of this update entry...
 
Since I switched to asynchronus ads I notice the ads sometimes loading well after the forum. I assume this is effecting my CTR. Anyone else?
 
Yes, you need the AdSense account to serve the ads.

The template code to implement that is in the main resource body.
 
All of the examples work - I use them on my own site.

You haven't stated what code you have used, where.
 
All of the examples work - I use them on my own site.

You haven't stated what code you have used, where.

In ad below content

Code:
<xen:hook name="ad_below_content" />
<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 = "xxx";
                            width = document.documentElement.clientWidth;
                            /* Message Below Responsive 2 */
                            google_ad_slot = "xxx";
                            google_ad_width = 320;
                            google_ad_height = 50;
                                if (width > 619) {
                                /* Message Below Responsive 1 */
                                google_ad_slot = "xxx";
                                google_ad_width = 468;
                                google_ad_height = 60;
                                }
                                    if (width > 879) {
                                    /* Message Below */
                                    google_ad_slot = "xxx";
                                    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>

Thanks for your time
 
Have you added it to the correct style?
I don't see any trace of it in the source code.

The style you are using does appear to have modified the default template code quite a lot.

Does it work in a completely default style?
 
I have added it to the template under the used style. Does it need to be specified elsewhere? How can you tell?

I will try in the default now.
 
Have you added it to the correct style?
I don't see any trace of it in the source code.

The style you are using does appear to have modified the default template code quite a lot.

Does it work in a completely default style?

It also does not work in the default style.
 
Oh, I see the problem...

You're using the wrong template - it should be ad_message_below.
 
@Brogan do you have page-level ads set up?

It says to add a code in the <head> tag of the page, and it provides option for Anchor/Overlay and Vignette ads on mobiles optimized by Google.

It looks really nice and have seen it in action on a few news sites, but was wondering if we'll be able to do it easily on XF?

Place this ad code in the <head> tag (or at the top of the <body>) of the pages where you want to show the ads. It’s the same ad code for every page and site, and you won’t need to change it even if you adjust your Page-level ads settings.
 
No, I haven't implemented anything like that.

I suspect it's just a case of following the instructions.
 
Hello! I'm currently using #10 Display in or after the first post in a thread and I've read the suggestion to wrap the ad in a div, floating it which works great thus far.

Now my question is how (via conditionals, CSS or a {xen:helper wordTrim function perhaps?) can I make an ad appear inside the actual post text ({xen:raw $message.messageHtml})?

Basically for lengthy posts I'm trying to automatically break up the post text after a few paragraphs, words or character count and insert an ad using the ad_message_body template. Any insight would be great, thanks!
 
Top Bottom