如何从数据库提供混合静态和动态广告?

发布于 2024-10-11 06:20:15 字数 439 浏览 4 评论 0原文

我正在 Django 中构建一个应用程序,需要将广告集成到网站中。我需要根据以下确定的“广告优先级”来投放广告:

  1. 如果页面“所有者”有一个他们已在系统中付费的广告,则首先投放该广告。
  2. 如果没有,请在其位置投放 Google AdWords 广告或其他类型的广告。

我对在像这样的动态网站中使用广告有点陌生,那么我应该做什么?显然,所有这些都应该由数据库支持,但是我应该如何对其建模?似乎会有 3 种类型的广告:图像/超链接自定义广告、Flash 自定义广告和 Google AdWords 广告。这非常准确吗?如果我这样做,我需要担心 XSS(跨站点脚本)吗?

如果你是我,你会如何在 Django 中做到这一点?我知道这有点主观,但我几乎一无所知,很想听到一些好的想法。如果只使用 Google AdWords 或类似服务就好了,但提供定制付费广告在商业模式中至关重要。

I'm building an application in Django that needs to integrate advertising into the site. I need to serve ads based on "ad priority" as determined by tho following:

  1. If the page "owner" has an ad that they have paid for in the system, serve that/those ad(s) first.
  2. If not, serve Google AdWords ads or some other type of ads in their place.

I'm somewhat new to working with ads in a dynamic site like this one, so what should I do? Obviously, all of this should be backed by a database, but how should I model it? It seems like there will be 3 types of ads: image/hyperlink custom ads, flash custom ads, and Google AdWords ads. Is this pretty accurate? Do I need to worry about XSS (cross-site-scripting) if I do this?

If you were me, how would you go about doing this in Django? I know it's somewhat subjective, but I'm pretty much in the dark and would love to hear some good ideas. It would be nice to simply go exclusively with Google AdWords or a similar service, but serving custom paid ads is pivotal in the business model.

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

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

发布评论

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

评论(2

冷心人i 2024-10-18 06:20:15

我会选择 Google Ad Manager。您可以投放自定义广告系列,如果没有,您可以将其设置为显示 AdSense。

I'd go with Google Ad Manager. You can serve custom campaigns, and if there're none, you can set it up to show AdSense.

就像说晚安 2024-10-18 06:20:15

我不使用 Django,但不久前我已经这样做了。我只是将 HTML 存储为数据库列之一。经过一些简单的逻辑来决定放置哪个广告后,我只需将广告 HTML 放置到页面上。

决定投放哪个广告的逻辑可能会变得极其复杂。我尝试了几种不同的方法,并希望我需要其他方法来处理所有广告场景。但您的要求听起来非常简单。

I don't use Django but I've done this not too long ago. I simply stored the HTML as one of the database columns. After some simple logic to decide which ad to place, I just put the ad HTML onto the page.

The logic to decide which ad to serve can get extremely complex. I tried a few different approaches and expect I'll need others to handle all advertising scenarios. But your requirements sound like they are pretty straight forward.

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