Implementing AdSense and the Code to exclude certain pages....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • WeddingFotos
    New Member
    • Feb 2004
    • 6
    • 3.0.0 'Gold'

    Implementing AdSense and the Code to exclude certain pages....

    I've been working with my vBulletin since the weekend so I am an absolute newbie with the code and such. I was just approved for AdSense. Can anyone help with the code? I have the code from AdSense and I want to place it just below my logo in the header. I am aware of how to do this, but I am not sure how to exclude the ads from showing up on the registration page, thank you pages or error pages.

    Any sort of code help here would be massively appreciated. Thanks so much.

    (Posted this in a previous AdSense thread but figured I should probably start a new one... And I appologise for yet another AdSense thread! I've been trying to read through the previous ones pertaining to AdSense but not really understanding the code has made it hard for me to figure out what to use and where to put it.)
  • Jake Bunce
    Senior Member
    • Dec 2000
    • 46598
    • 3.6.x

    #2
    You can enclose the banner code within a template conditional to exclude the registration page, like this:

    Code:
    <if condition="THIS_SCRIPT != 'register'">
    	BANNER CODE HERE
    </if>
    As for redirection and error pages... redirection pages don't use the header template so the banner code should not show up on those (assuming the banner code is in your header). Error pages are spawned by many different files so the template conditional method will not work. I don't know of a way to exclude error pages... I tried on my own forums recently.

    Comment

    • Zachery
      Former vBulletin Support
      • Jul 2002
      • 59097

      #3
      The best place to actually post adsense is the navbar, it shouldnt show on any important pages that google doesnt like.

      Comment

      • aky
        Senior Member
        • Sep 2003
        • 133
        • 3.5.x

        #4
        maybe this will help


        Originally posted by WeddingFotos
        I've been working with my vBulletin since the weekend so I am an absolute newbie with the code and such. I was just approved for AdSense. Can anyone help with the code? I have the code from AdSense and I want to place it just below my logo in the header. I am aware of how to do this, but I am not sure how to exclude the ads from showing up on the registration page, thank you pages or error pages.

        Any sort of code help here would be massively appreciated. Thanks so much.

        (Posted this in a previous AdSense thread but figured I should probably start a new one... And I appologise for yet another AdSense thread! I've been trying to read through the previous ones pertaining to AdSense but not really understanding the code has made it hard for me to figure out what to use and where to put it.)

        Comment

        • WeddingFotos
          New Member
          • Feb 2004
          • 6
          • 3.0.0 'Gold'

          #5
          Thanks

          Thank you all... I think it looks better under the header, but I decided to put it in the NavBar as suggested.

          Some pages it shows relevant ads on, and other pages it shows the charity ads... I wonder why that is?

          Comment

          • raxafarian
            Senior Member
            • Apr 2003
            • 317
            • 3.0.0 'Gold'

            #6
            are you seeing the charity ads on 'search' type pages? The way it works is google spiders every link to your site to target the ads. The search results page does not have a static link...it changes all the time, so ads don't get targeted.

            Comment

            • RaZor Edge
              Member
              • Oct 2001
              • 73
              • 3.8.x

              #7
              It will always show a Charity ads when a new post is posted or when the page is just updated.

              I show the Google ads on the footer templates for most of the forum (example)...

              <if condition="$foruminfo[forumid] == 69 OR $foruminfo[forumid] == 67 OR $foruminfo[forumid] == 68 OR $foruminfo[forumid] == 48 OR THIS_SCRIPT == 'showthread' OR THIS_SCRIPT == 'search' OR THIS_SCRIPT == 'register'">
              <br>
              <else />

              ADS CODE

              </if>
              But a display them on a different way on showthread templates (example)...
              Last edited by RaZor Edge; Thu 17 Mar '05, 5:55am.
              http://www.fnnation.com/pub/small/fnforum.gif http://www.fnnation.com/pub/small/luttemedia.gif

              Comment

              • WeddingFotos
                New Member
                • Feb 2004
                • 6
                • 3.0.0 'Gold'

                #8
                Nice display, RaZor Edge! Your statement about new or newly updated pages is correct. That seems to have been the issue (as now the ads are relevant... mostly )

                Thank you for the spider explination, decostop! That makes sense now too.

                Thanks everyone... I think I'm all set now.

                Comment

                • patrick24601
                  New Member
                  • May 2004
                  • 14
                  • 3.5.x

                  #9
                  Where is this header file everybody is talking about ? I am looking in admincp and I see nothing with the name header in it.

                  I am trying to do a similair thing - add google adsense and my own banner mgmt system to the header and footer.

                  Thanks.

                  Comment

                  • maikj
                    New Member
                    • Dec 2001
                    • 19

                    #10
                    User CP

                    I used

                    PHP Code:
                    <if condition="THIS_SCRIPT != 'register'"
                    to exclude the registration Page. My Ads are under the navbar.
                    How do i exclude the UserCP?

                    The Site is under
                    Add more credibility to your site - get a premium domain today. Straight-forward shopping experience.


                    Thx
                    Maik

                    Comment

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

                      #11
                      You can exclude the User CP by adding the red code to the condition:

                      Code:
                      <if condition="THIS_SCRIPT != 'register' [color=red]AND THIS_SCRIPT != 'usercp'[/color]">

                      Comment

                      • Stingraynyc
                        New Member
                        • Jan 2002
                        • 23

                        #12
                        there has to be a better way to to this than I have done. Am I using more server resources with my code? (below)

                        The reason I have done it this way is google will come and spider any page the code is on after it is looked at. I have private forums that google cant get into so had to exclude those, plus all the profile, register pages etc. I originally used the code for showthread and forumdisplay only.. however I had the problem with the private forums.

                        The way I see it, google disallows register pages for a reason, it will spider the page every time someone looks at it, They dont want to continually spider pages that have no content or get error messages when trying to get into the page (like private forums, login, memberlist, private, profile etc. etc.) so all the scripts in my code are not allowed by google and will get my adsense dropped If I didnt exclude them.

                        Is there a way to only allow showthread and forumdisplay but disallow the private forums?

                        here is my code

                        <if condition="$foruminfo[forumid] == 18 OR $foruminfo[forumid] == 29 OR $foruminfo[forumid] == 32 OR $foruminfo[forumid] == 40 OR $foruminfo[forumid] == 22 OR $foruminfo[forumid] == 36 OR THIS_SCRIPT == 'search' OR THIS_SCRIPT == 'faq' OR THIS_SCRIPT == 'calendar' OR THIS_SCRIPT == 'usercp' OR THIS_SCRIPT == 'memberlist' OR THIS_SCRIPT == 'login' OR THIS_SCRIPT == 'mailmember' OR THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'member' OR THIS_SCRIPT == 'profile' OR THIS_SCRIPT == 'private' OR THIS_SCRIPT == 'subscription' OR THIS_SCRIPT == 'report' OR THIS_SCRIPT == 'showgroups' OR THIS_SCRIPT == 'newthread' OR THIS_SCRIPT == 'register'">
                        <else />Google Adsense Code here</if>
                        Last edited by Stingraynyc; Sun 9 May '04, 12:12pm.

                        Comment

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

                          #13
                          Originally posted by Stingraynyc
                          Is there a way to only allow showthread and forumdisplay but disallow the private forums?
                          Use this:

                          Code:
                          <if condition="(THIS_SCRIPT == 'forumdisplay' OR THIS_SCRIPT == 'showthread') AND ($forumid != X AND $forumid != Y AND $forumid != Z)">
                          
                          ADSENSE CODE
                          
                          </if>
                          Where X, Y, and Z are forumids of private forums.

                          Comment

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