Responsive AdSense

Responsive AdSense

Look up ^

The node ID is part of the URL, when hovering over or editing the node in the ACP.
 
I have a responsive template set-up for my mobile users. In ad_message_below, I have a 300x250 Adsense unit and I'm using the UIX theme. I noticed that it 'extends' the second post and ends up breaking out of the message container. Is there a way to prevent this? I'm using your 'Sponsored' code for my desktop users and it works perfectly. I wonder if this could somehow get edited so the ad would appear by itself, against the background of the page, rather than within the message.

Here's the sponsored code:

Code:
<xen:hook name="ad_message_below" />

<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 1 AND {$thread.reply_count} > 0 AND !{$visitor.user_id}">
    <li class="message">
        <div class="messageUserInfo">
            <div class="messageUserBlock">
                <div class="avatarHolder" style="height: 102px; width: 102px">
                    <span class="helper"></span>
                    <img src="http://www.mysite.com/forum/styles/uix/xenforo/avatars/avatar_a.png" alt="Avatar" height="96px" width="96px" style="border: 0px; padding: 2px" />
                </div>
                <h3 class="userText">
                <span style="font-weight: bold; color: #666666">Sponsored</span>
                <em class="userTitle" itemprop="title">Advertisement</em>
                </h3>
                <span class="arrow"><span></span></span>
            </div>
        </div>
        <div class="messageInfo primaryContent">
            <div class="messageContent">
                <article>
                    <blockquote class="messageText ugc baseHtml">

ADCODE

</div>
                    </blockquote>
                </article>
            </div>
        </div>
    </li>
</xen:if>

Here's the code for my mobile responsive ad:

Code:
<xen:hook name="ad_message_below" />
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 1 AND !{$visitor.user_id}">
<div style="text-align: center; margin-top:20px">
AD CODE
</xen:if>

ad-place.webp
 
Has anyone noticed on a laptop - (shouldn't be responsive) it shows really small ads? @Brogan - have seen it on your site as well. What gives? it should be full size - it is sometimes...thoughts?

Screen Shot 2014-02-18 at 8.05.41 PM.webp

On a page refresh it resizes properly for a large screen...

Screen Shot 2014-02-18 at 8.08.58 PM.webp

From your site Brogan.

Screen Shot 2014-02-18 at 8.08.02 PM.webp
 
Responsive occurs regardless of device. If the width of the browser triggers a smaller ad, the smaller ad is shown.
 
No, it's just positioned via CSS.

You can however use a media query to trigger at the same point, depending on what it is you want to do.
 
Today I noticed that the lost password page was showing ads, so I took them away to make it cleaner and more clear for those users that want to come back.

Just in case, the name is of the template is lost_password
 
I've just checked with Google Webmaster Tools and in Search Appearance > Structured Data it is showing me a lot of threads, each with the same error:

Missing: name (fn)

Upon investigation, this appears to be from the Google Adsense advertisement in the first post of each thread.

Currently the the ad_message_below template has this code in it to show that it is a Google Adsense advertisement:

Code:
<h3 class="userText">
<span style="font-weight: bold">Google AdSense</span>
<em class="userTitle" itemprop="title">Guest Advertisement</em>
</h3>

I think that by adding an additional class to the span style will resolve this:

Code:
<h3 class="userText">
<span class="username" itemprop="name" style="font-weight: bold">Google AdSense</span>
<em class="userTitle" itemprop="title">Guest Advertisement</em>
</h3>
 
What is wrong with this code?
HTML:
<xen:hook name="ad_message_below" />
<xen:if is="!in_array({$forum.node_id}, array(81, 67))">
<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', 'thread_create', 'thread_reply', 'lnblog_entry_create'))">
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id} AND !{$visitor.user_id}">
    <li class="message">
        <div class="messageUserInfo">
            <div class="messageUserBlock">
                <div class="avatarHolder"><span class="helper"></span><img src="http://domain.name/styles/default/xenforo/avatar-marketing.jpg" width="96px" height="96px"></div>
                <h3 class="userText">
                    <span style="font-weight: bold">Marketing</span>
                    <em class="userTitle" itemprop="title"></em>
                </h3>
                <span class="arrow"><span></span></span>
            </div>
        </div>
       <div class="messageInfo primaryContent">
            <div class="messageContent">
                <blockquote class="messageText ugc baseHtml">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- caskanja responsive ispod prvog posta -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-******************"
     data-ad-slot="*************"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
                </blockquote>
            </div>
           </div>
       </li>
</xen:if>
</xen:if>
</xen:if>
 
I disable all adons via config.php. Same results - not showing.
But, after delete
HTML:
<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', 'thread_create', 'thread_reply', 'lnblog_entry_create'))">
ads is showing. :)
 
Hi,
thanks for this useful overview. I`d like to use a condition for showing ads on different pages:

Code:
<xen:if is="{$contentTemplate} == 'xyz'">
This content will show on the xyz template
</xen:if>

how can I find out which contentTemplates are available? Is there a list of them somewhere?
thank you - all the best,
Sacha
 
The FAQ explains how to identify the template name: http://xenforo.com/community/threads/frequently-asked-questions.5183/#post-181112

How can I find out which template to edit?
Using your browser, view the page source and look for a line of code near the top of the page which begins
<div id="content" class="; the class is the name of the template. So for the main forum page, the line of code is:<div id="content" class="forum_list">, which makes the template forum_list.
 
thanks, maybe someone can use my code:

Code:
<xen:if is="{$contentTemplate} == 'forum_list'">
    <!-- start -->

<xen:elseif is="{$contentTemplate} == 'search_form'" />
    <!-- search -->

<xen:elseif is="in_array({$contentTemplate}, array('conversation_list','account_alerts','news_feed_page','member_notable','member_view'))" />
    <!-- social networking -->

<xen:elseif is="in_array({$contentTemplate}, array('register_form','online_list','news_feed_page','thread_reply','thread_create','conversation_add','conversation_reply','help_index','help_smilies','help_bb_codes','help_trophies','help_cookies'))" />
    <!-- corporate com -->

<xen:elseif is="in_array({$category.node_id}, array(3,293))" />
    <!-- entertainment and lifestyle -->

<xen:elseif is="in_array({$category.node_id}, array(56,8,5))" />
    <!-- mixed, multi-topic -->


<xen:else />
    <!-- no IVW -->

</xen:if>

List of contentTemplates I found:
  • forum_list
  • search_form
  • conversation_list
  • account_alerts
  • news_feed_page
  • member_notable
  • member_view
  • register_form
  • online_list
  • news_feed_page
  • thread_reply
  • thread_create
  • conversation_add
  • conversation_reply
  • help_index
  • help_smilies
  • help_bb_codes
  • help_trophies
  • help_cookies
 
thanks, maybe someone can use my code:

Code:
<xen:if is="{$contentTemplate} == 'forum_list'">
    <!-- start -->

<xen:elseif is="{$contentTemplate} == 'search_form'" />
    <!-- search -->

<xen:elseif is="in_array({$contentTemplate}, array('conversation_list','account_alerts','news_feed_page','member_notable','member_view'))" />
    <!-- social networking -->

<xen:elseif is="in_array({$contentTemplate}, array('register_form','online_list','news_feed_page','thread_reply','thread_create','conversation_add','conversation_reply','help_index','help_smilies','help_bb_codes','help_trophies','help_cookies'))" />
    <!-- corporate com -->

<xen:elseif is="in_array({$category.node_id}, array(3,293))" />
    <!-- entertainment and lifestyle -->

<xen:elseif is="in_array({$category.node_id}, array(56,8,5))" />
    <!-- mixed, multi-topic -->


<xen:else />
    <!-- no IVW -->

</xen:if>

List of contentTemplates I found:
  • forum_list
  • search_form
  • conversation_list
  • account_alerts
  • news_feed_page
  • member_notable
  • member_view
  • register_form
  • online_list
  • news_feed_page
  • thread_reply
  • thread_create
  • conversation_add
  • conversation_reply
  • help_index
  • help_smilies
  • help_bb_codes
  • help_trophies
  • help_cookies
For you, use BD Widget to make it easy to manage or add. :)
 
Back
Top Bottom