Selectively disabling Google Adsense in certain forums

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pierguy
    Senior Member
    • May 2003
    • 129
    • 4.1.x

    Selectively disabling Google Adsense in certain forums

    Is there a way to disable Google Adsense integration in individual forums, while leaving them running everywhere else?
  • Jake Bunce
    Senior Member
    • Dec 2000
    • 46598
    • 3.6.x

    #2
    You can edit the templates and use conditionals:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> Ad Location Templates

    For example, this condition will exclude forumid X:

    Code:
    <if condition="$forumid != [color=red]X[/color]">
    
    </if>

    Comment

    • pierguy
      Senior Member
      • May 2003
      • 129
      • 4.1.x

      #3
      Thanks. When I go to edit one of these templates, say ad_navbar_below, nothing actually shows. I'm not seeing any code into which to insert that conditional. I don't want to just drop this conditional in and wipe out the default VB code for that template.

      Comment

      • Steve Machol
        Former Customer Support Manager
        • Jul 2000
        • 154488

        #4
        That means you do not have any Google Adsense in that template. You need to use the templates where your Google Adsense code is being used.
        Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
        Change CKEditor Colors to Match Style (for 4.1.4 and above)

        Steve Machol Photography


        Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


        Comment

        • TrueDarKZONE
          New Member
          • Aug 2009
          • 10
          • 3.8.x

          #5
          ok how would you disable adds for sertan member groups like 6 admins

          would it be?

          Code:
          <if condition="$membergroup != 6">
          
          </if>

          Comment

          • Steve Machol
            Former Customer Support Manager
            • Jul 2000
            • 154488

            #6
            See #5 here: http://www.vbulletin.com/forum/showt...t=conditionals
            Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
            Change CKEditor Colors to Match Style (for 4.1.4 and above)

            Steve Machol Photography


            Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


            Comment

            • pierguy
              Senior Member
              • May 2003
              • 129
              • 4.1.x

              #7
              So if I'm using Google Adsense Integration and it's set to "High" which template do I need to add this conditional to to stop ads from showing on specific forums?

              <if condition="$forumid != X">

              </if>

              I'm sorry to be obtuse, but there appears to be no documentation in the manual showing either the built-in integration, or how the Ad Location Templates function.

              Comment

              • Steve Machol
                Former Customer Support Manager
                • Jul 2000
                • 154488

                #8
                You would add this to whichever template contains your ad code.
                Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
                Change CKEditor Colors to Match Style (for 4.1.4 and above)

                Steve Machol Photography


                Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


                Comment

                • Saviour
                  Member
                  • Mar 2007
                  • 52
                  • 3.7.x

                  #9
                  Not to hijack this thread, but how would one disable the ads from showing up on the WOL page?

                  I know it will be a conditional, but how would it be coded?
                  Free Computer Help
                  sigpic

                  Comment

                  • Jake Bunce
                    Senior Member
                    • Dec 2000
                    • 46598
                    • 3.6.x

                    #10
                    <if condition="THIS_SCRIPT != 'online'">

                    </if>

                    Comment

                    • Saviour
                      Member
                      • Mar 2007
                      • 52
                      • 3.7.x

                      #11
                      Originally posted by Jake Bunce
                      <if condition="THIS_SCRIPT != 'online'">

                      </if>
                      Thanks, Jake...sorry it took me so long to get back to you.

                      Anyway...that seems to work, but I have multiple pages with Ad Sense in the header and footer that I don't want there...and this would mean I'd have to make several <if> statements surrounding the Ad Sense code.

                      It would seem the best thing for me to do would be to add an array, but I'm not quite sure how to code it.

                      Also, any page that is blocked by my robots.txt file or group permissions for guests...seems to cause issues with what content is displayed in the Google ads.

                      Can you recommend a better way for me to handle this? Pages like the memberlist, or who's online, or user profiles, etc., etc...are the ones where I basically get those service ads...instead of content relevant to the site.
                      Free Computer Help
                      sigpic

                      Comment

                      • Jake Bunce
                        Senior Member
                        • Dec 2000
                        • 46598
                        • 3.6.x

                        #12
                        <if condition="!in_array(THIS_SCRIPT, array('online','index','forumdisplay'))">

                        </if>

                        Comment

                        • Saviour
                          Member
                          • Mar 2007
                          • 52
                          • 3.7.x

                          #13
                          Originally posted by Jake Bunce
                          <if condition="!in_array(THIS_SCRIPT, array('online','index','forumdisplay'))">

                          </if>
                          Sweet! It's all good, now. Thanks, again, Jake!
                          Free Computer Help
                          sigpic

                          Comment

                          • Mr. Mikey
                            Senior Member
                            • Feb 2009
                            • 187

                            #14
                            Originally posted by pierguy
                            So if I'm using Google Adsense Integration and it's set to "High" which template do I need to add this conditional to to stop ads from showing on specific forums?

                            <if condition="$forumid != X">

                            </if>

                            I'm sorry to be obtuse, but there appears to be no documentation in the manual showing either the built-in integration, or how the Ad Location Templates function.
                            The code the official adsense integration will insert is:

                            Code:
                            <if condition="$GLOBALS['vbulletin']->adsense_pub_id">
                            <div style="width:728px; margin:0 auto; padding-bottom:1em">
                            <script type="text/javascript"><!--
                            google_ad_client = "{$GLOBALS['vbulletin']->adsense_pub_id}";
                            google_ad_host = "{$GLOBALS['vbulletin']->adsense_host_id}";
                            google_ad_width = 728;
                            google_ad_height = 90;
                            google_ad_format = "728x90_as";
                            google_ad_type = "text_image";
                            google_ad_channel = "";
                            google_color_border = "$stylevar[alt2_bgcolor_hex]";
                            google_color_bg = "$stylevar[alt1_bgcolor_hex]";
                            google_color_link = "$stylevar[body_link_n_fgcolor_hex]";
                            google_color_text = "$stylevar[body_fgcolor_hex]";
                            google_color_url = "$stylevar[body_link_n_fgcolor_hex]";
                            google_ui_features = "rc:6";
                            //-->
                            </script>
                            <script type="text/javascript"
                              src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                            </script>
                            </div>
                            </if>
                            Say, for "High" and in "ad_navbar_below"...

                            So what you need to do, in your "Ad Location" templates, where you wish to ad the ad's is this:

                            Code:
                             <if condition="$forumid != X">
                            <if condition="$GLOBALS['vbulletin']->adsense_pub_id">
                            <div style="width:728px; margin:0 auto; padding-bottom:1em">
                            <script type="text/javascript"><!--
                            google_ad_client = "{$GLOBALS['vbulletin']->adsense_pub_id}";
                            google_ad_host = "{$GLOBALS['vbulletin']->adsense_host_id}";
                            google_ad_width = 728;
                            google_ad_height = 90;
                            google_ad_format = "728x90_as";
                            google_ad_type = "text_image";
                            google_ad_channel = "";
                            google_color_border = "$stylevar[alt2_bgcolor_hex]";
                            google_color_bg = "$stylevar[alt1_bgcolor_hex]";
                            google_color_link = "$stylevar[body_link_n_fgcolor_hex]";
                            google_color_text = "$stylevar[body_fgcolor_hex]";
                            google_color_url = "$stylevar[body_link_n_fgcolor_hex]";
                            google_ui_features = "rc:6";
                            //-->
                            </script>
                            <script type="text/javascript"
                              src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                            </script>
                            </div>
                            </if></if>
                            Unless I'm mistaken, that exact code should do the job for you...(with the X changed to the forumid).. try pasting it into any ad location template, it'll fetch your google publisher number etc for you.

                            Tell me if it worked
                            My Forums: The Geek District - Off Topic Hut
                            My Blog: Mikeylicious
                            Projects: Shorten URL's with kwn.me

                            Comment

                            • pierguy
                              Senior Member
                              • May 2003
                              • 129
                              • 4.1.x

                              #15
                              I appreciate everyone's help. I've decided to go another route. Instead of using the low/medium/high settings, I've been dropping my Adsense code into the templates and saving to see where the ads show up. Not the most efficient method, but it works.

                              Now that I've done that, which conditional would I wrap around a particular ad to *only* have it display to one particular usergroup? I want to stick a third ad out there for just the unregistered group, but I can't find the documentation on that particular <if> statement. Is there a way to do that, or will I have to come at it the other way round and include the group numbers of the groups I don't want the ad to show to, like this?

                              <if condition="$membergroup != 6,7,8">

                              </if>

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...