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

XF 1.1 Passing customised targeting criteria into ad tags

Discussion in 'XenForo Questions and Support' started by akia, Dec 24, 2011.

  1. akia

    akia Well-Known Member

    I've been looking at the Google DFP Small Business documentation and I want to take advantage of the fact that I can target ads to whether my members are male or female, etc etc.

    According to the documentation I've need to add the following to the page header:


    Code:
    <script language="JavaScript">
      GA_googleAddAttr("Sex", "$Variable");
    </script>

    But how to I get Xenforo to update the $Variable bit with whether the member is male/female/unspecified. Etc

    Also if I was to add some custom field to the profile for hobbies ect, How would I add those as well.

    Thanks
     
    Andy.N likes this.
  2. akia

    akia Well-Known Member

    Anyone?
     
  3. Fuhrmann

    Fuhrmann Well-Known Member

    Code:
    <script language="JavaScript">
      GA_googleAddAttr("Sex", {$visitor.gender});
    </script>
    This will use 'male' or 'female'.
     
  4. akia

    akia Well-Known Member

    Perfect.

    Thanks
     
  5. akia

    akia Well-Known Member

    Well what I've done is added this to my template:
    Code:
    <xen:if hascontent="true">
    <xen:contentcheck>
    <xen:if is="{$visitor.gender}">
    <script language="JavaScript">
      GA_googleAddAttr("Sex", "{$visitor.gender}");
    </script>
    </xen:if>
    </xen:contentcheck>
    </xen:if>
    I'm not a programmer but it seems to work, so if there is no gender specified it hides the tag. if it helps anyone else.
     
    Fuhrmann likes this.

Share This Page