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

XF 1.2 Sidebar - Google advert

Discussion in 'Styling and Customization Questions' started by tommydamic68, Jan 5, 2014.

  1. tommydamic68

    tommydamic68 Well-Known Member

    How do you achieve an Google ad in the sidebar @Brogan ?

    Screen Shot 2014-01-05 at 5.36.21 AM.png
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Use the ad_sidebar_below_visitor_panel.
     
    tommydamic68 likes this.
  3. tommydamic68

    tommydamic68 Well-Known Member

    is this the right div for the border?

    Code:
    <center><xen:hook name="ad_sidebar_below_visitor_panel" /><div class="sectionMain"><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- sidebar adver -->
    <ins class="adsbygoogle"
         style="display:inline-block;width:200px;height:200px"
         data-ad-client="ca-pub-25xxxxxxxxxxxxx"
         data-ad-slot="425555555"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script></div></center>
     
    Brick likes this.
  4. Brogan

    Brogan XenForo Moderator Staff Member

    I personally don't use center but that will work.

    This is mine:
    Code:
    <xen:hook name="ad_sidebar_below_visitor_panel" />
    
    <xen:if is="in_array({$contentTemplate}, array('forum_list', 'cta_featuredthreads_featured'))">
        <xen:include template="cta_countdown_forum_sidebar" />
    </xen:if>
    
    <style type ="text/css">
    .sidebar-below-visitor-panel-dynamic {
    width: 250px;
    height: 250px;
    }
    </style>
    
    <xen:if is="!{$visitor.user_id}">
        <xen:if is="!in_array({$contentTemplate}, array('search_results'))">
            <xen:if is="@enableResponsive">
                <div class="section">
                    <div class="secondaryContent">
                        <div style="height: 250px; padding: 5px auto;">
                            <div style="text-align: center">
                                <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                                <!-- Sidebar Below Visitor Panel - Dynamic -->
                                <ins class="adsbygoogle sidebar-below-visitor-panel-dynamic"
                                     style="display:inline-block"
                                     data-ad-client="ca-pub-1234567890"
                                     data-ad-slot="45454545"></ins>
                                <script>
                                (adsbygoogle = window.adsbygoogle || []).push({});
                                </script>
                            </div>
                        </div>
                    </div>
                </div>
            <xen:else />
                <div class="section">
                    <div class="secondaryContent">
                        <div style="height: 250px; padding: 5px;">
                            <div style="text-align: center">
                                <script type="text/javascript"><!--
                                google_ad_client = "ca-pub-9876543210";
                                /* Sidebar Below Visitor Panel */
                                google_ad_slot = "56745656";
                                google_ad_width = 250;
                                google_ad_height = 250;
                                //-->
                                </script>
                                <script type="text/javascript"
                                src="//pagead2.googlesyndication.com/pagead/show_ads.js">
                                </script>
                            </div>
                        </div>
                    </div>
                </div>
            </xen:if>
        </xen:if>
    </xen:if>
    
     
    tommydamic68 likes this.
  5. tommydamic68

    tommydamic68 Well-Known Member

    Thanks - where do I find the background color here in the image. not the ad - the background color behind it.

    Screen Shot 2014-01-05 at 8.20.39 AM.png
     
  6. Brogan

    Brogan XenForo Moderator Staff Member

    That's the default sidebar secondary content - .sidebar .secondaryContent
     
  7. tommydamic68

    tommydamic68 Well-Known Member

    Any way to get the ad block corners "square" like the other side bar elements?

    Screen Shot 2014-02-09 at 8.18.51 AM.png
     
  8. RoldanLT

    RoldanLT Well-Known Member

    By the way, based on my experience Sidebar for Adsense is not worth it.
     
  9. tommydamic68

    tommydamic68 Well-Known Member

    Yeah - your right, just checked my google ad performance. Any other place you recommend, have the footer and top navabar area. I made 7 cents since the first of this month.

    Screen Shot 2014-02-09 at 9.09.33 AM.png
     
  10. RoldanLT

    RoldanLT Well-Known Member

    Just a quick advice ;)
    Focus on Thread / Top navigation
     

Share This Page