ACGray
ACGray

Reputation: 666

What's the best way of implementing a 'popular content' display?

How do I show a list of 'most popular (articles|posts|whatever) for a period such as the past day? (Essentially replicate the functionality of the Radioactivity Drupal module.)

Upvotes: 3

Views: 141

Answers (3)

Ben Guild
Ben Guild

Reputation: 5116

http://popularposts.benguild.com/ ... that's why I built this. It just receives data from Google Analytics scheduled emails and reminds you to extend them before they stop working after a year.

Upvotes: 0

Rajat Saxena
Rajat Saxena

Reputation: 3925

Maybe you could decide which posts are popular based on the number of comments on those posts

Upvotes: 0

jterrace
jterrace

Reputation: 67063

Here's what I would do:

  1. If you're not already, sign up for Google Analytics and add the google analytics javascript to each of your pages. This will track view count for you.
  2. Using the google data API library, fetch the information you want. For example, you could ask for the most popular pages on your site in the last day.
  3. Once you have a script that fetches the data you're interested in, you can use django-celery to schedule a periodic task (e.g. once an hour, once a day) to run your script and cache the output in your database for display on your site.

Upvotes: 5

Related Questions