I run a local directory website (think yelp/yell.com etc) and need to provide analytical data to the businesses listed on the site.
我运行本地目录网站(想想yelp / yell.com等),需要向网站上列出的企业提供分析数据。
I need to track the following:
我需要跟踪以下内容:
1) Number of visitors to specific pages (ie: Jim's widgets was viewed 65 times)
1)特定页面的访问者数量(即:Jim的小部件被查看了65次)
2) Number of times a user clicks a link (ie: 25 users clicked to visit your website)
2)用户点击链接的次数(即:25位用户点击访问您的网站)
I am able to do this by simply adding one to the relevant number every time an action occurs.
我可以通过在每次动作发生时向相关数字添加一个来完成此操作。
What I would like to be able to do is split this into date ranges, for example, last 30 days, last 12 months, all time.
我希望能够做到的是将其分为日期范围,例如,过去30天,过去12个月,所有时间。
How do I store this data in the database? I only need the theory, not the code! If someone can explain the best way to store this information, I would be extremely grateful.
如何将此数据存储在数据库中?我只需要理论,而不是代码!如果有人能够解释存储这些信息的最佳方式,我将非常感激。
For example, do I use one table for dates, one for the pages/links and another for the user data (links clicked/pages visited)? The only solution I have so far is to add a new row to the DB every time one of these actions happens, which isn't going to scale very well.
例如,我是将一个表用于日期,一个用于页面/链接,另一个用于用户数据(链接点击/访问过的页面)?到目前为止,我唯一的解决方案是每当其中一个动作发生时向DB添加一个新行,这不会很好地扩展。
Thanks to anyone that can help.
感谢任何可以提供帮助的人。
1 个解决方案
#1
3
I would not reinvent the wheel and use an already available solutions such as Piwik. It can actually read your normal weblogs to provide all the information you asked for.
我不会重新发明*并使用已有的解决方案,如Piwik。它实际上可以读取您的正常网络日志,以提供您要求的所有信息。
If for some reason you still need a custom solution, I would not save the tracking data in ranges, but rather use exact time and url-data for each individual page call (what your normal weblog provides). The cumulated data should be generated on-the-fly in your logic section, e.g. through a SQL-view:
如果由于某种原因您仍然需要自定义解决方案,我不会将跟踪数据保存在范围内,而是为每个单独的页面调用使用准确的时间和URL数据(您的正常博客提供的内容)。累积数据应在您的逻辑部分中即时生成,例如:通过SQL视图:
SELECT count(url),url
FROM calllog
WHERE calldate > NOW()-30days
#1
3
I would not reinvent the wheel and use an already available solutions such as Piwik. It can actually read your normal weblogs to provide all the information you asked for.
我不会重新发明*并使用已有的解决方案,如Piwik。它实际上可以读取您的正常网络日志,以提供您要求的所有信息。
If for some reason you still need a custom solution, I would not save the tracking data in ranges, but rather use exact time and url-data for each individual page call (what your normal weblog provides). The cumulated data should be generated on-the-fly in your logic section, e.g. through a SQL-view:
如果由于某种原因您仍然需要自定义解决方案,我不会将跟踪数据保存在范围内,而是为每个单独的页面调用使用准确的时间和URL数据(您的正常博客提供的内容)。累积数据应在您的逻辑部分中即时生成,例如:通过SQL视图:
SELECT count(url),url
FROM calllog
WHERE calldate > NOW()-30days