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

How can I install tracker codes on category-level?

Discussion in 'XenForo Questions and Support' started by badlands, Nov 23, 2011.

  1. badlands

    badlands Member

    Dear all,

    I recently joined the Glam Publisher network. They require that I insert a traffic tracker code on category level of the forum. Can anyone help me if and where this is possible? Currently I only see the possibility to enter such code on the index / thread level of the forum. Thanks!!
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Moved from suggestions to support.

    You will need to associate your forum account with your license to post in the customer forums.
     
  3. badlands

    badlands Member

    Done. Would be awesome if you could help me out with the issue above :)
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    By default categories act as anchors, not pages.

    You will need to change them to pages in the ACP -> Options -> Node & Forum List: Create Pages for Categories.

    Then you can insert your tracker code in the category_view template.
     
  5. badlands

    badlands Member

    Hi Brogan,

    many thanks! As I understand it this will allow to use one tracker for all category-views. Is there a way to assign specific trackers to specific categories?

    Thanks and best wishes,

    Simon
     
  6. badlands

    badlands Member

    Is it possible to do this with an if-query? E.g. "if forum = category ( code )"? Does anyone know?
     
  7. Brogan

    Brogan XenForo Moderator Staff Member

    You could try using this conditional:
    <xen:if is="{$category.node_id} == x">

    You may also need to add this to the category_view template:
    <xen:container var="$categoryId">{$category.node_id}</xen:container>

    That's just a guess on my behalf, I haven't tested it.
     
  8. badlands

    badlands Member

    Hi, that sounds good, thanks - category node id would be the number of the category? I.e. my URL "categories/marktplatz.24/" would result in <xen:if is="{$category.node_id} == 24">?

     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    Yes, exactly.
     
  10. badlands

    badlands Member

    Sounds very good and logical - is somehow not working, however. Tried it with a test-pixel that shows up when I don't apply the condition below. Anything missing in the code?

    <xen:if is="{$category.node_id} == 24">
    <img src="/pics/test.jpg">
    </xen:if>
     
  11. Brogan

    Brogan XenForo Moderator Staff Member

    I've just tested it and it works fine.

    Double check the node ID and template you're working in.

    The container code isn't required (thanks Jake).
     
    Lawrence likes this.
  12. badlands

    badlands Member

    Ok - maybe its the template. Which one are you using to implement the code? Many thanks!!
     
  13. Brogan

    Brogan XenForo Moderator Staff Member

    The category_view template.
     
  14. badlands

    badlands Member

    Awesome, it works. Thanks a bunch!
     

Share This Page