Ad Slots - Conditions

7 posts in this topic

Posted

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:



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? (http://xenforo.com/c...83/#post-182355)


<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>

Share this post


Link to post
Share on other sites

Posted

http://community.invisionpower.com/resources/documentation/index.html/_/tutorials/skinning/

This is the general skinning documentation. Looks like you are after this article: http://community.invisionpower.com/resources/documentation/index.html/_/tutorials/skinning/template-logic-and-variables-r155

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

Posted

Thanks, I've had a read but it looks confusing.

Is this something that would start make sense when I start using IPB?

Share this post


Link to post
Share on other sites

Posted

It's just a different syntax/variable.

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

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.

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

BigStamp likes this

Share this post


Link to post
Share on other sites

Posted

Thanks,

That makes a little more sense.

Share this post


Link to post
Share on other sites

Posted

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)
</if>

 

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

Posted

Yes, that would accomplish what you asked.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Who's Browsing   0 members

    No registered users viewing this page.