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.

Reset Entry Views Tracking

June 16, 2009 3:48pm

Subscribe [5]
  • #1 / Jun 16, 2009 3:48pm

    grantmx

    1439 posts

    I may be missing something quite obvious, but is there anyway to reset entry views tracking for all entries back to “0”?  I know you can do it for templates, but can it be done for an entry?

  • #2 / Jun 16, 2009 5:12pm

    Mark Bowen

    12637 posts

    You could do this with a simple query if you wanted to but definitely make sure to back up your database first before doing any of this :

    UPDATE exp_weblog_titles
    SET view_count_one = '0', view_count_two = '0', view_count_three = '0', view_count_four = '0'

    Best wishes,

    Mark

  • #3 / Jun 16, 2009 5:18pm

    grantmx

    1439 posts

    Kinda drastic.  I take that there’s no setting for that, eh?

  • #4 / Jun 16, 2009 5:23pm

    Sue Crocker

    26054 posts

    No, there isn’t a setting for it, but it’s not *that* drastic of a query. 😊

  • #5 / Jun 16, 2009 5:37pm

    grantmx

    1439 posts

    Only because I love you sooo much Sue, I’ll take your word on it.  LOL 😉

  • #6 / Jun 16, 2009 5:46pm

    Mark Bowen

    12637 posts

    Only because I love you sooo much Sue, I’ll take your word on it.  LOL 😉

    What about some love here too? 😉

    It’s not really that drastic if that’s what you really want to do. If there were a setting for this that’s all it would do anyway 😉

  • #7 / Jun 16, 2009 5:54pm

    grantmx

    1439 posts

    Com’on Mark. Your my brotha’ from anotha’ motha’!  😊

    Thanks, just wondered if I was missing something.

  • #8 / Jun 16, 2009 6:08pm

    Mark Bowen

    12637 posts

    Com’on Mark. Your my brotha’ from anotha’ motha’!  😊

    Thanks, just wondered if I was missing something.

    Jus’ kidding ya mate! 😊

    Remember definitely back up before doing this just in case you find out you didn’t want to do it after all 😊

    Hope it all goes well for you.

    Best wishes,

    Mark

  • #9 / Jun 16, 2009 6:46pm

    grantmx

    1439 posts

    Hmmm…didn’t seem to work.  When I look at the view count for the entries, the values are still there.  I used the Database Query Form in the CP.

    http://316networks.com/includes/most_popular/

  • #10 / Jun 16, 2009 6:48pm

    grantmx

    1439 posts

    Ooops…take that back.  I see that it worked now.  Thanks!  This could be set up as a CRON job right?

  • #11 / Jun 17, 2009 5:16am

    Ingmar

    29245 posts

    Sure… just run the query on the command line, and add it to your crontab.

  • #12 / Jun 17, 2009 5:17am

    Mark Bowen

    12637 posts

    Ooops…take that back.  I see that it worked now.  Thanks!  This could be set up as a CRON job right?

    Yep absolutely or a SQL query in say an embedded template which goes on one of the pages on your site which gets hit often if that’s what you want to do.

    If you don’t mind my asking though I’m just wondering why you would want to keep on clearing this?

    Best wishes,

    Mark

  • #13 / Jun 17, 2009 10:54am

    grantmx

    1439 posts

    I’m tracking the most read, commented on or emailed entries on a particular site using the code referenced in this thread.

    I’m sure there is a better way, but I just haven’t put the brain power to it yet.  😛

  • #14 / Oct 15, 2009 1:44pm

    Melophobe

    23 posts

    Hello, would one of you be so kind as to clarify how I would run that command? Our blog uses the entry views tracking for “popular content.” The end result is that older articles dominate the popular tab and nothing is dynamic—not the effect we were hoping for.

    Ideally, I’d like to use a command in the code below to just count the viewcounts accrued in the past month, but I don’t suppose that is possible?

    {exp:weblog:entries weblog="concert-reviews|fifty-word-reviews|articles" status="Open" limit="10" orderby="view_count_one" dynamic="off"}

    Otherwise, I assume I’ll just have to zap the viewcount for all articles back to zero once a month to achieve the desired effect. Are there any other repercussions to resetting the viewcount?

    Thanks!

  • #15 / Oct 15, 2009 4:07pm

    Ingmar

    29245 posts

    Ideally, I’d like to use a command in the code below to just count the viewcounts accrued in the past month, but I don’t suppose that is possible?

    It’s not possible out of the box, but you can always run a custom SQL query. Something like this:

    SELECT * FROM `exp_weblog_titles` NATURAL JOIN `exp_weblog_data`
    WHERE UNIX_TIMESTAMP(ADDDATE(entry_date, INTERVAL 30 DAY)) <= UNIX_TIMESTAMP(NOW())
    ORDER BY view_count_one DESC
    LIMIT 10

    Give that code a try.

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

ExpressionEngine News!

#eecms, #events, #releases