Ad Slots - Conditions

7 posts in this topic

I'm currently using Google Dfp for my ad serving, with the asyncronous single call tags.

One thing I found was that if I just added the code to my header it was calling ads slots that were not actually being show on the page.

With Xenforo I've managed to solve this from by doing the following:

<xen:if is="{$visitor.user_id}"><xen:if is="in_array({$contentTemplate}, array('forum_list','online_list','news_feed_page_global','conversation_view','member_list','search_results','search_results_users_only','report_view'))">googletag.defineSlot('/803025/Forum-Header_Small-Members', [468, 60], 'div-gpt-ad-1344102488647-5').addService(googletag.pubads());<xen:else />googletag.defineSlot('/803025/Forum-Header-Members', [728, 90], 'div-gpt-ad-1344102488647-3').addService(googletag.pubads());</xen:if><xen:else /><xen:if is="in_array({$contentTemplate}, array('forum_list','online_list','news_feed_page_global','conversation_view','member_list','search_results','search_results_users_only','report_view'))">googletag.defineSlot('/803025/Forum-Header_Small-Guests', [468, 60], 'div-gpt-ad-1344102488647-4').addService(googletag.pubads());<xen:else />googletag.defineSlot('/803025/Forum-Header-Guests', [728, 90], 'div-gpt-ad-1344102488647-2').addService(googletag.pubads());</xen:if></xen:if>

<xen:if is="{$visitor.user_id}">googletag.defineSlot('/8035025/Forum-Footer-Members', [728, 90], 'div-gpt-ad-1344102488647-1').addService(googletag.pubads());<xen:else />googletag.defineSlot('/8035025/Forum-Footer-Guests', [728, 90], 'div-gpt-ad-1344102488647-0').addService(googletag.pubads());</xen:if>

<xen:if is="{$contentTemplate} == 'member_view'"><xen:if is="{$visitor.user_id}">googletag.defineSlot('/8035025/Forum-Members_Page-Members', [468, 60], 'div-gpt-ad-1344102488647-7').addService(googletag.pubads());<xen:else />googletag.defineSlot('/8035025/Forum-Members_Page-Guests', [468, 60], 'div-gpt-ad-1344102488647-6').addService(googletag.pubads());</xen:if></xen:if>

<xen:if is="{$contentTemplate} == 'thread_view'"><xen:if is="!{$visitor.user_id}">googletag.defineSlot('/8035025/Forum_Post', [728, 90], 'div-gpt-ad-1344102488647-16').addService(googletag.pubads());</xen:if></xen:if>

This allows me to show different ads to members or guests, and also only makes the call for the ad slot if its on the page thats being loaded.

Is this something I can achieve with IPB, I know I can do it for the members/guests as i've seen the code for that. But are there Conditionals that I can wrap the code in depending whether someone is viewing the home page, forum lists or a thread?

Also is there a list of the conditionals that can be used like what's available over on Xenforo? (

Share this post

Link to post
Share on other sites

This is the general skinning documentation. Looks like you are after this article:

If you were looking to determine if the user was viewing a topic, you could for instance do

<if test="ipsRegistry::$current_application == 'forums' AND ipsRegistry::$current_module == 'forums' AND ipsRegistry::$current_section == 'topics'">

Share this post

Link to post
Share on other sites

It's just a different syntax/variable.

vs <if test="ipsRegistry::$current_application == 'forums' AND ipsRegistry::$current_module == 'forums' AND ipsRegistry::$current_section == 'topics'">

<xen:if is="{$contentTemplate} == 'thread_view'">

As you can see, the general syntax is similar. In your first example it's checking a variable that holds the template name. In the example I provided, you are checking which application, module and section is being called. You might also be able to check other variables as well (for instance, if you want to know if someone is viewing a topic, checking if $this->request['showtopic'] is set should work), but I was trying to provide an off-hand example to give you an idea.

BigStamp likes this

Share this post

Link to post
Share on other sites

One of our publisher clients is an IPB users and needs to implement our ads conditionally on their forum. All our other other clients use vb, xf, and vanilla so I don't have any experience with this on IPB. The goal is to serve larger ads (2 medium boxes) to guests/unregistered or else a leaderboard to members/admins.

A member on the TAZ board suggested the code below would work as the conditional to trigger the different ads:

<if test="memberbox:|:$this->memberData['member_id']">
Logged in members advert (all members who have logged in)
<else />
Not logged in advert (e.g. guests and members who have not logged in)

Is this the case? Just checking here because after all, you folks are the experts!

Share this post

Link to post
Share on other sites

Your content will need to be approved by a moderator

You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   You have pasted content with formatting.   Remove formatting

  Only 75 emoticons maximum are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor


  • Recently Browsing   0 members

    No registered users viewing this page.