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

XF 1.2 Google DFP custom targeting variables

Discussion in 'XenForo Questions and Support' started by kontrabass, Nov 26, 2013.

  1. kontrabass

    kontrabass Well-Known Member

    In vbulletin I used the following to target DFP campaigns to forums and usergroups:
    Code:
    googletag.pubads().setTargeting("forumid", "$forumid");
    googletag.pubads().setTargeting("usergroup", "$bbuserinfo[usergroupid]");
    Is there an equivalent in xenforo?
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    Where do you want these placed? Within threads, nodes, everywhere?
     
  3. kontrabass

    kontrabass Well-Known Member

    I guess within nodes. Ideally so that if someone wants to target a campaign to our "Amps" forum, I can do that within DFP by referencing the node id from XenForo (rather than generating a new ad code in DFP and adding conditionals in XenForo for each forum targeted campaign). Not sure if it's as simple as
    Code:
    googletag.pubads().setTargeting("forumid", "$nodeid");
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    If you add the code into forum_view you can use: $forum.node_id.
     
    kontrabass likes this.
  5. kontrabass

    kontrabass Well-Known Member

    Excellent - thanks Jeremy!
     
  6. kontrabass

    kontrabass Well-Known Member

    For future reference for others: If you're using Google DFP and want to target campaigns to specific forums, here's the correct syntax calling the xenforo forum.node_id variable:

    Code:
    googletag.pubads().setTargeting("forumid", "{$forum.node_id}");
     

Share This Page