最佳实践:跟踪横幅展示次数

发布于 2024-08-05 06:29:13 字数 474 浏览 1 评论 0原文

我正在 php/mysql 中编写一个横幅广告引擎。我不想使用 OpenX 或交钥匙解决方案,因为将会有一堆自定义功能,我宁愿不依赖现有系统来适应这些功能。

以下是我目前的印象架构的想法和方法:

  • 通过目标站点上的 javascript 片段对横幅服务器发出请求
  • 服务器已缓存要提供的横幅列表,并根据需要返回适当的图像。
  • 印象被记录到日志文件中,类似于 apache 的访问日志样式:使用旋转文本文件,每次印象添加一行。
  • 日志文件记录用户 IP、URL、横幅 ID、时间等。
  • 日志文件每小时轮换一次,然后汇总(也每小时)到 mysql 数据库,以便广告商可以获得(接近)活动的实时统计数据。

我担心的是:

  • 写入“日志”文件是记录印象的有效且可扩展的方式吗?我们预计每月可提供 13-1500 万次展示。
  • 日志写入方法有什么陷阱吗?

I am writing a banner ad engine in php/mysql. I don't want to use OpenX or a turn-key solution because there is going to be a bunch of custom functionality that I would rather not rely upon an existing system to have to flex to accommodate.

Here is the thinking and my current approaches to the impressions architecture:

  • Requests to banner server come in via javascript snippet on target site
  • Server has cached list of banners to serve and returns appropriate image as needed.
  • Impressions are recorded to log files similar to apache's access log style: using a rotating text file, adding one line per impression.
  • Log files record user IP, url, banner id, time, etc.
  • Log files are rotated hourly and are then summarized (also hourly) to a mysql DB so advertisers can get (close to) real-time stats on activity

My concerns are:

  • Is writing to a "log" file an efficient and scalable way to record the impressions? We expect to serve 13-15 million impressions a month.
  • Any pitfalls with the log writing approach?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

季末如歌 2024-08-12 06:29:13

我建议将 lighttpd 与 mod_accesslog 一起使用。当静态文件推送是主要目标时,建议使用 lighttpd。

由于您在各个网站上使用 JavaScript,因此请在请求图像的查询字符串中包含所需的信息。顺便说一句,这类似于 Google Analytics 聚合信息的方式。

在每次轮换期间轮换 Web 服务器访问日志并进行解析。

塑造您的访问日志格式,使其可直接导入到临时 mysql 表中以进行进一步处理。

如果您预计早期会获得大量展示次数并希望在某个时候进行扩展,则可以考虑使用 CDN。

I would suggest using lighttpd with mod_accesslog . lighttpd is recommended where static file pushing is the main objective.

Since you are using javascript on the individual websites, include the needed information in the query string requesting the image. This is similar to how Google Analytics aggregates their information, by the way.

Rotate the web servers access log and parse during each rotation.

Sculpt you access log format to be directly importable into a temporary mysql table for further processing.

If you are expecting massive amounts of impressions early and expect to scale at some point, you may consider using a CDN.

似最初 2024-08-12 06:29:13

不要忘记也记录用户代理。

我建议使用文本文件作为日志并使用脚本解析它(制作缓存等)以进一步显示统计信息

don't forget to record user agent as well.

i would recommend using a text file for log and having scripts parsing it (making caches etc.) for further display of stats

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文