ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Channel entry view tracking not working

August 07, 2012 4:49am

Subscribe [2]
  • #1 / Aug 07, 2012 4:49am

    Clive Portman

    83 posts

    Hi,
    I’ve got this within the single entry template:

    {exp:channel:entries
      channel="items"
      url_title="{segment_4}"
      limit="1"
      track_views="one"
      dynamic="off"
    }

    and this within the listing template:

    {exp:channel:entries
      channel="items"
      category="{embed:category}"
      orderby="{view_count_one}"
      sort="asc"
      dynamic="off"
    }

    but nothing is happening with the ordering in the listing template.

    I’ve tried testing the view tracking by adding {view_count_one} to the single entry template and it returns 0 every time.

    Channel entry view tracking is turned on in the CP. Any ideas?

    Thanks,
    Clive

  • #2 / Aug 07, 2012 12:17pm

    Boyink!

    5011 posts

    Try

    orderby="view_count_one"
  • #3 / Aug 08, 2012 5:51am

    Clive Portman

    83 posts

    I had it like that originally, but was getting nothing, so put the curly brackets around it. Shouldn’t {view_count_one} return something other than zero if it’s in a template?

  • #4 / Aug 08, 2012 7:32am

    Boyink!

    5011 posts

    With the braces around it, it’s a variable.  That’s the form you should use to display the results. Without the braces and used in the opening of the channel:entries tag pair it’s a parameter, telling EE how to order the results.

    Once you have the pieces in place are you hitting a specific entry in your single entry template a bunch of times to increment the variable?

  • #5 / Aug 08, 2012 7:55am

    Clive Portman

    83 posts

    Yes, I was. It didn’t seem to be making any difference, not just to the order of the results, but also remaining at zero when displayed as a variable in the template. Is there any way to view the numbers in the CP?

  • #6 / Aug 08, 2012 7:57am

    Boyink!

    5011 posts

    No.

    I wonder if it’s because you aren’t running your single entry template in dynamic mode.  Why is that, BTW?

  • #7 / Aug 08, 2012 8:01am

    Clive Portman

    83 posts

    I’ve got a related entry url_title also in the url. The structure of the url is:

    /template_group/category/related_entry/url_title
  • #8 / Aug 08, 2012 8:03am

    Boyink!

    5011 posts

    That’s probably it - I’ll bet EE can’t decide which url_title to increment the counter for.

  • #9 / Aug 08, 2012 8:06am

    Clive Portman

    83 posts

    Okay. If that’s so, I’m stuffed right? I know it has to be a single entry, but it doesn’t say anything in the docs about it having to be dynamic.

  • #10 / Aug 08, 2012 8:12am

    Boyink!

    5011 posts

    I’d test it first just to ensure that removing the extra url_title but leaving the tag not in dynamic mode and see what happens.  If no-go then run it in traditional dynamic mode just to see what happens.

    I’m guessing it’s not in the docs because it wasn’t an expected use-case and no one has run into it before.

  • #11 / Aug 08, 2012 8:30am

    Clive Portman

    83 posts

    Thanks for all this. I’ve run what you’ve said earlier, so it looks like I’ll have to try something else.

    I suppose I could call a separate template with javascript each time the entry is loaded, just for the sake of counting the entry, but it doesn’t feel right to me.

  • #12 / Aug 08, 2012 11:30am

    Lisa Wess

    20502 posts

    Thank you for the help, Mike!

    Clive, have you tried the relaxed_track_views hidden config variable?

  • #13 / Aug 09, 2012 4:36am

    Clive Portman

    83 posts

    Hmm. Looks promising.

    EDIT: And it’s worked. Thanks Lisa - you can close this one off.

  • #14 / Aug 09, 2012 10:54am

    Lisa Wess

    20502 posts

    WOOT!  Glad to have helped you out, Clive.  If anything else comes up, you know where to find us!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases