Resource icon

DFP Integration into Xenforo + Adblock detection

AzzidReign

Well-known member
AzzidReign submitted a new resource:

DFP Integration into Xenforo - Includes targeting nodes, responsive ads, and adblock detection.

This guide will walk you through how to set up DoubleClick For Publishers (DFP) to target specific forums/nodes, making DFP ads responsive, and how to detect AdBlock programs and replacing it with a message to the user.

Thanks go out to:
@Clickfinity for pointing me in the right direction on targeting specific forums/nodes.
@Jaxel for allowing me to utilize his CSS from his AdBlock tutorial

Read more about this resource...
 
Last edited:
I've been trying to think of additional ways we can utilize Custom Criteria to give our advertisers the ability to target just about anything. So here's a list of a few things that I think we can properly target and utilize:

Parent + sibling forums
Code:
googletag.pubads().setTargeting("parentid", "{$forum.parent_node_id}");
Pretty much same concept as the forumid.

Target thread:
Code:
googletag.pubads().setTargeting("threadid", "{$thread.thread_id}");
You'd follow the same concept as the forumid part of the guide.

Gender:
Code:
googletag.pubads().setTargeting("gender", "{$visitor.gender}");
Instead of free-form, you can use the other option and define the values. For xenforo, there are 3 options for gender that you will have to enter.

Age:
Code:
googletag.pubads().setTargeting("age", "{$user.age}");
I'm not sure about this code. I can't seem to find any information on this anywhere. I have a feeling this is incorrect. Would $visitor.age work?

I'm working on potentially targeting custom fields, but we'll see. Most people likely won't need most of this stuff but I'm hoping to have it all compiled in this one thread in the event an advertiser does request one of these.
 
After running this for a few days, I've decided to remove the adblock detection as it appears those who use adblock won't click ads so it shot my CTR down drastically, which in turn, dropped my CPM/RPM down to about 50% that it was at.

Something I was also thinking about with targeting...if you wanted to target a specific usergroup (say...a CPM network just for your users), you could easily follow the same code scheme and usergroup ID as the above examples.
 
After running this for a few days, I've decided to remove the adblock detection as it appears those who use adblock won't click ads so it shot my CTR down drastically, which in turn, dropped my CPM/RPM down to about 50% that it was at.
You have the point (y)
 
@AzzidReign are you using the build in adsense option in DFP or are you actually adding Adsense code as the creative?

I am asking as i can't get my text ads to look in the way I want. Kinda addicted to the new Roboto look and adsense in DFP is showing like its still 1983.
 
@AzzidReign are you using the build in adsense option in DFP or are you actually adding Adsense code as the creative?

I am asking as i can't get my text ads to look in the way I want. Kinda addicted to the new Roboto look and adsense in DFP is showing like its still 1983.
I do both. I like to do split testing with colors.
 
So something I'm thinking about doing is removing the whole AdBlock warning message. For guests, it would show as a message to register. For members, it will be asking them to become a premium member. Rather than bringing attention that the alert is there because of adblock and then the user disabling AdBlock dropping my CTR/RPM.
 
I don't have premium membership.
But for adblock detector it helps me encouraging guest to register ;)
 
I have run the adblock detector and I am starting to think that Google Adsense does not like it, as when the adblock detector is on my earnings take a big dip, when I turn it off the earnings go back up again. The number of ad views are about the same no matter if the adbock detector is on or off.

Has anyone else noticed this or is it just me?
 
I have run the adblock detector and I am starting to think that Google Adsense does not like it, as when the adblock detector is on my earnings take a big dip, when I turn it off the earnings go back up again. The number of ad views are about the same no matter if the adbock detector is on or off.

Has anyone else noticed this or is it just me?
Yes, that's why I have stated I've disabled it for the time being. I wonder what the correlation is. I thought it had to do with members or guests on the site that have ABP and disable it, but then don't click any ads, thus dropping CTR and RPM.
 
Parent + sibling forums
Code:
googletag.pubads().setTargeting("parentid", "{$forum.parent_node_id}");

This is excellent :) I'm trying to figure out how to target ads to a category node... do you have any tips? Thanks for the awesome tips and guide!
 
This is excellent :) I'm trying to figure out how to target ads to a category node... do you have any tips? Thanks for the awesome tips and guide!
Sorry, my time has been limited lately. But Brogan has outlined a lot of the conditional statements in which you can use with DFP. I think this code is what you are looking for:
How can I show content in all forums with a specific parent?
<xen:if is="{$forum.parent_node_id} == x">
This content will show in forums of parent x
</xen:if>


Of course you are going to have to modify the google code similar to the nodeID one that I've done. If you can't figure it out, I'll get back to this later and add it to the guide.
 
Slightly related to this. Have you been able to figure out how to use the passback tags.
 
Slightly related to this. Have you been able to figure out how to use the passback tags.
I haven't tried it but it should be rather easy. Create ad units like so:
Tier 1 [location 1]
Tier 1 [location 2...etc]
Tier 2 [location 1]
Tier 2 [location 2...etc]
Tier etc....

Then what you will do is take your tier 2 ad unit code and put it in main network used for Tier 1. If that network can't fill, it will go to your passback/back up tag which will be tier 2 ad units. You can do the same with Tier 2 and 3 and etc...

Let me know if this helps.
 
Cool idea, but what if my DFP feeds multiple forums on multiple domains? How would the forumid work then? It may not be unique.

Is there a Xenforo variable that would identify the thread topic? Is so, one could even match the ads to a specific topic.
 
Cool idea, but what if my DFP feeds multiple forums on multiple domains? How would the forumid work then? It may not be unique.

Is there a Xenforo variable that would identify the thread topic? Is so, one could even match the ads to a specific topic.
For your first question, it would work the same unless you are targeting node=x on forum a and node=y on forum b...then you are screwed. What you would have to do is set up 2 different campaigns (should be doing that anyways if you are sending across multiple sites), and then this technique would work just fine.

For your second question, I'm not sure if there is a way...I'd have to look into it a bit but I'm sure someone here may already know. I would look through Brogan's conditional thread to see if there is a way to target a thread/topic.
 
Any idea how to expose the ids of the user groups the user belongs to? It's a lot more flexible than just targeting guests/registered users.
 
Any idea how to expose the ids of the user groups the user belongs to? It's a lot more flexible than just targeting guests/registered users.
Hey Jeff! I'm not quite sure, and again, I'm not a coder but I do a lot of trial and error to get stuff to work. So if I were to need it, I would take something like this from the conditional statement tutorial:
{xen:helper ismemberof, $visitor, x}

Hack it to pieces to see what happens so my code might look something like:
googletag.pubads().setTargeting("usergroupid", "{xen:helper ismemberof, $visitor}");

This would follow the general idea of the forumid part of the guide. Assuming that {xen:helper ismemberof, $visitor} pumps out a number, then you could do the custom criteria and properly target 1 usergroup or multiple in a single custom criteria (again, similar to forumid).

Please let me know if this works so I can add it for others as I'm sure there are many people that would like this.

One question though, what is your goal in this?
 
Top Bottom