Best Practices: Tracking Banner Impressions

好久不见. 提交于 2019-12-08 03:41:28

问题


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?

回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/1428731/best-practices-tracking-banner-impressions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!