如何判断网络客户端是否阻止广告?

发布于 2024-07-04 01:10:00 字数 48 浏览 4 评论 0原文

记录访问我的网站并将其浏览器设置为阻止广告的访问者数量的统计数据的最佳方法是什么?

What is the best way to record statistics on the number of visitors visiting my site that have set their browser to block ads?

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

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

发布评论

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

评论(5

下壹個目標 2024-07-11 01:10:00

您需要考虑屏蔽广告的不同方式。 首先要查看的是它们是否正在运行 noscript,因此您可以添加一个脚本来检查这一点。

接下来就是看看他们是否挡住了闪光灯,一部小电影应该可以做到这一点。

如果您查看 adblock 站点,就会发现一些迹象表明它是如何阻止的:
元素隐藏是如何工作的?

如果您进一步查看该页面,您将看到传统的 chrome探测不起作用,因此您需要尝试解析更改后的 DOM。

You need to think about the different ways that ads are blocked. The first thing to look at is whether they are running noscript, so you could add a script that would check for that.

The next thing is to see if they are blocking flash, a small movie should do that.

If you look at the adblock site, there is some indication of how it does blocking:
How does element hiding work?

If you look further down that page, you will see that conventional chrome probing will not work, so you need to try and parse the altered DOM.

盛装女皇 2024-07-11 01:10:00

将用户 ID 添加到广告请求中:

<img src="./ads/viagra.jpg?{user.id}"/>

这样您就可以检查哪些用户看到了哪些广告。

Add the user id to the request for the ad:

<img src="./ads/viagra.jpg?{user.id}"/>

that way you can check what ads are seen by which users.

╄→承喏 2024-07-11 01:10:00

由于像 AdBlock 这样的程序实际上从不请求广告,因此您必须查看服务器日志以查看同一用户是否访问了网页但没有访问广告。 这是假设广告位于同一服务器上。

如果您的广告位于单独的服务器上,那么我建议不可能这样做。

阻止用户拦截广告的最佳方法是使用由服务器生成并显示在 html 中的内嵌文本广告。

Since programs like AdBlock actually never request the advert, you would have to look the server logs to see if the same user accessed a webpage but didn't access an advert. This is assuming the advert is on the same server.

If your adverts are on a separate server, then I would suggest it's impossible to do so.

The best way to stop users from blocking adverts, is to have inline text adverts which are generated by the server and dished up inside your html.

一百个冬季 2024-07-11 01:10:00

我想您可以将广告印刷品与网站上的页面浏览量(可以从分析软件获得)进行比较。

I suppose you could compare the ad prints with the page views on your website (which you can get from your analytics software).

只是在用心讲痛 2024-07-11 01:10:00

AdBlock 论坛这样说用于检测AdBlock。 经过一些调整后,您可以使用它来收集一些统计数据。

setTimeout("detect_abp()", 10000);
var isFF = (navigator.userAgent.indexOf("Firefox") > -1) ? true : false,
    hasABP = false;

function detect_abp() {
  if(isFF) {
    if(Components.interfaces.nsIAdblockPlus != undefined) {
      hasABP = true;
    } else {
      var AbpImage = document.createElement("img");
      AbpImage.id = "abp_detector";
      AbpImage.src = "/textlink-ads.jpg";
      AbpImage.style.width = "0";
      AbpImage.style.height = "0";
      AbpImage.style.top = "-1000px";
      AbpImage.style.left = "-1000px";
      document.body.appendChild(AbpImage);
      hasABP = (document.getElementById("abp_detector").style.display == "none");

      var e = document.getElementsByTagName("iframe");
      for (var i = 0; i < e.length; i++) {
        if(e[i].clientHeight == 0) {
          hasABP = true;
        }
      }
      if(hasABP == true) {
        history.go(1);
        location = "http://www.tweaktown.com/supportus.html";
        window.location(location);
      }
    }
  }
}

AdBlock forum says this is used to detect AdBlock. After some tweaking you could use this to gather some statistics.

setTimeout("detect_abp()", 10000);
var isFF = (navigator.userAgent.indexOf("Firefox") > -1) ? true : false,
    hasABP = false;

function detect_abp() {
  if(isFF) {
    if(Components.interfaces.nsIAdblockPlus != undefined) {
      hasABP = true;
    } else {
      var AbpImage = document.createElement("img");
      AbpImage.id = "abp_detector";
      AbpImage.src = "/textlink-ads.jpg";
      AbpImage.style.width = "0";
      AbpImage.style.height = "0";
      AbpImage.style.top = "-1000px";
      AbpImage.style.left = "-1000px";
      document.body.appendChild(AbpImage);
      hasABP = (document.getElementById("abp_detector").style.display == "none");

      var e = document.getElementsByTagName("iframe");
      for (var i = 0; i < e.length; i++) {
        if(e[i].clientHeight == 0) {
          hasABP = true;
        }
      }
      if(hasABP == true) {
        history.go(1);
        location = "http://www.tweaktown.com/supportus.html";
        window.location(location);
      }
    }
  }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文