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

Looking for Ad plugin

Discussion in 'XenForo Questions and Support' started by MrChris, Aug 3, 2012.

  1. MrChris

    MrChris Member

    What is some good ad plugins you use for your forums or recommend ?
     
  2. surfsup

    surfsup Well-Known Member

  3. Chris D

    Chris D XenForo Developer Staff Member

    Depends exactly what you want.

    XenForo is pre-loaded with a load of special templates (all prefixed with ad_ ) which are blank, and will enable you to edit and paste your ad-provider's code in.
     
    Jake Bunce likes this.
  4. MrChris

    MrChris Member

    Chris I didn't know that I found it so would I just add the code in the template ? I'm just not sure how to go about this[​IMG]
     
  5. Chris D

    Chris D XenForo Developer Staff Member

    Yeah exactly right, but there's lots of these ad_ templates.

    ad_templates.PNG

    You can use any that you like, and each one represents a different position on your forum.

    If you were using Google Ads for example, you'd get some code from them and paste it anywhere in your ad_above_top_breadcrumb template. That would appear here for example:

    ad_top_breadcrumb.PNG
     
    Jake Bunce likes this.
  6. craigiri

    craigiri Well-Known Member

    Yes, you can add code in various places in those templates.

    In general, you do want to put a div around it.....

    Code:
    <div style="text-align: center;">
    </div>
    You can also use various IF statements to show X ad in X forum, etc.

    A very simple ad rotation add-on is here:
    http://xenforo.com/community/resources/bd-rotating-ads.292/

    Or, you can use just about any external script. I use an ancient perl script which then inserts ads depending on the forum node.
     
    Jake Bunce and Digital Doctor like this.
  7. snoopy5

    snoopy5 Well-Known Member

    If I just insert the Google adsense code (javascript) in the ad_xxxx template, how can I make sure that only specific usergroups will see/ not see this ad?

    Code:
    <script type="text/javascript"><!--
    google_ad_client = "ca-pub-1234567";
    /* blabla */
    google_ad_slot = "1311156088";
    google_ad_width = 728;
    google_ad_height = 90;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
     
  8. Chris D

    Chris D XenForo Developer Staff Member

    To specify usergroups that WILL see the ad:

    Code:
    <xen:if is="{xen:helper ismemberof, $visitor, 1, 2, 3">
    	YOUR AD CODE
    </xen:if>
    Where 1, 2 and 3 are usergroups that will see the ad.

    To specify usergroups that WON'T see the ad:

    Code:
    <xen:if is="!{xen:helper ismemberof, $visitor, 1, 2, 3">
    	YOUR AD CODE
    </xen:if>
    Where 1, 2 and 3 are usergroups that will not see the ad.

    (Notice the ! before the {xen:helper tag... ! always means NOT basically... So if you were reading that in English it would read IF IS NOT MEMBER OF 1, 2, 3 :))
     
    Jake Bunce likes this.
  9. snoopy5

    snoopy5 Well-Known Member


    Hi

    when I insert this code and try to save it in ACP, I get a template syntax error in this line:

    Code:
    [code]<xen:if is="!{xen:helper ismemberof, $visitor, 1, 2, 3">

    If I use the other code, same error, also in line 1.

    The whole code looks like this in that specific ad_template:

    Code:
    <xen:hook name="ad_above_top_breadcrumb" />
    <xen:if is="{xen:helper ismemberof, $visitor, 1, 2, 3">
    <script type="text/javascript"><!--
    google_ad_client = "ca-pub-1234567";
    /* blablaCI nach x Beiträgen quer */
    google_ad_slot = "1311156088";
    google_ad_width = 728;
    google_ad_height = 90;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </xen:if>
     
  10. Chris D

    Chris D XenForo Developer Staff Member

    I missed a curly bracket :mad:

    Code:
    <xen:hook name="ad_above_top_breadcrumb" />
    <xen:if is="{xen:helper ismemberof, $visitor, 1, 2, 3}">
    <script type="text/javascript"><!--
    google_ad_client = "ca-pub-1234567";
    /* blablaCI nach x Beiträgen quer */
    google_ad_slot = "1311156088";
    google_ad_width = 728;
    google_ad_height = 90;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </xen:if>
    That will work now.
     
    Jake Bunce and snoopy5 like this.
  11. snoopy5

    snoopy5 Well-Known Member

    Thank you very much!

    The second code works (exclude groups). The first one not . I think because all users that have a premium group additionally, are at the same time part of the registered usergroup. So a default show them the ad will probbalby not work. But the second code works peferctly. Thanks again.
     
    Chris D likes this.
  12. snoopy5

    snoopy5 Well-Known Member

    Hi

    is in XF an internal limit how many ads can be shown on one page? It seems to me, that XF shows never more than 3 ads at the same time. I only use Google adsense. Or am I not allowed to use 3x the same google code for the same kind of banner?
     
  13. Chris D

    Chris D XenForo Developer Staff Member

    There is no XenForo imposed limits. I would imagine this to be a Google Adsense configuration but I'm not entirely sure - not heard of any limits there either.
     
    snoopy5 likes this.
  14. tenants

    tenants Well-Known Member

    Jake Bunce, snoopy5 and Chris D like this.

Share This Page