XF 2.0 Advertising

limboclub

Active member
We've run an upgrade on a clone of the site to test. Lots of issues but we suspected as much.

One thing that worries me is the "ad_" templates are now gone, and the Advertising system has not absorbed them. There are no advertisements in the list.

Is there a list of xf:ad hooks in version 2?

Is there a way to avoid losing all ad_ templates? Automatically moving them to the Advertising system?

Or are we left with the job of recreating dozens of advertising locations from scratch?
 
@Mike I posted this one:

But it just occurred to me it might be specific to the Advertising system.

Can you call the template name from within an advertisement?

eg:

<xf:if is="in_array({$template}, ['category_view','search_results'])">
Ad code
</xf:if>

or

<xf:if is="$template == 'forum_list'">
Ad code
</xf:if>

It doesn't seem to work for me.
 
A very late night of wrestling with the ad system. I am booked into therapy in a few days.


* Figured out how to call $template:
$xf.reply.template

* And how to call custom fields for GAM:
Code:
setTargeting('inserttargetname', ['{$xf.visitor.Profile.custom_fields.insertfieldname}']).

* But the Xf2 version of $forum.parent_node_id remains elusive. This is needed so a GAM ad can be easily assigned to a category, not just a single forum.

* And still unsure how new advertising locations are added.
 
Last edited:
It seems the doco I can find is a very basic guide on how to set things up from scratch.

Anything else and it is hours of tedious trial and error, or using sometimes unreliable user-generated guides and thread posts.

(I've deleted a Trump-like rant here. Just use your imagination. :D )
 
And back to salvaging our advertising.

We had an old ad template that uses this conditional:

<xf:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id} AND !{$canReply}">

On every page of every thread, after post number 1, if it's not a private conversation, and the user cannot reply to the thread.

Anyone know the new variables for the ones I have used?

I'm looking at this conditional now:

<xf:if is="$post.position % $xf.options.messagesPerPage == x">
Show content...
</xf:if>

So I am really looking for the new versions of:
$message.conversation_id
$canReply

Or a new way to express those in the conditional.
 
Last edited:
And another long lost variable found:

Instead of
$forum.parent_node_id

Use:
$forum.Node.parent_node_id

This is useful for advertisement targeting using Google Ad Manager:

setTargeting('forum', ['{$__globals.forum.node_id}']).
setTargeting('forum-parent', ['{$forum.Node.parent_node_id}']).
 
Last edited:
Top Bottom