实现“热门内容"显示的最佳方式是什么? [英] What's the best way of implementing a 'popular content' display?

查看:33
本文介绍了实现“热门内容"显示的最佳方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何显示过去一天等时间段内最流行(文章|帖子|无论什么)"的列表?(基本上复制 Radioactivity Drupal 模块的功能.)

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.)

推荐答案

我会这样做:

  1. 如果您还没有注册,请注册 Google Analytics 并将 Google Analytics javascript 添加到你的每一页.这将为您跟踪观看次数.
  2. 使用 google 数据 API 库,获取您想要的信息.例如,您可以询问您网站上最后一天最受欢迎的网页.
  3. 一旦你有一个脚本来获取你感兴趣的数据,你就可以使用 django-celery 安排一个周期性任务(例如每小时一次,一次一天)运行您的脚本并将输出缓存在您的数据库中以在您的网站上显示.
  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.

这篇关于实现“热门内容"显示的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆