简体   繁体   English

Firefox 增强的隐私保护正在阻止数据层推送到谷歌标签管理器

[英]Firefox Enhanced Privacy Protection is blocking Datalayer push to Google Tag Manager

Over the past few weeks I've realised that the conversion tracking in Google Analytics of a website we built and maintain has been off by about 20% - 40% each day.在过去的几周里,我意识到我们构建和维护的网站在谷歌分析中的转化跟踪每天下降了大约 20% 到 40%。

When testing in any browser but Firefox, everything works fine and you can see conversions pushing into Analytics straight away.在除 Firefox 之外的任何浏览器中进行测试时,一切正常,您可以看到转化立即推入 Analytics。

However, in Firefox, when you have Enhanced Privacy Protection turned ON, (it comes switched on as default now) you get the following error:但是,在 Firefox 中,当您打开增强隐私保护时,(现在默认打开)您会收到以下错误:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.googleadservices.com/pagead/conversion/957837126/wcm?cc=ZZ&dn=01858439338&cl=ITVOCP2S_34Qxt7dyAM&ct_eid=2 .跨域请求被阻止:同源策略不允许读取https://www.googleadservices.com/pagead/conversion/957837126/wcm?cc=ZZ&dn=01858439338&cl=ITVOCP2S_34Qxt7dyAM&ct_eid=2处的远程资源。 (Reason: CORS request did not succeed). (原因:CORS 请求没有成功)。

As soon as you switch off Enhanced Privacy Protection it works perfectly.一旦您关闭增强隐私保护,它就会完美运行。

The code I am using to push to datalayer, if its of any relevance is:我用来推送到数据层的代码(如果有任何相关性)是:

<script type="text/javascript">
  document.addEventListener( 'wpcf7mailsent', function( event ) {
   window.dataLayer.push({
      "event" : "cf7submission",
      "eventAction": "FormSubmission",
      "eventCategory": "Contact Form Submission",
      "eventCallback" : function() {
        // Firefox never gets to run this callback to redirect page - which is what triggered further investigation.
        window.location.href = "https://www.domain.co.uk/thank-you/"; 
        return false;
      },
      "eventTimeout" : 2000 // I had to add this in so that it still redirects to thank you when datalayer push fails.
    });    
  }, false );
</script>

The event listener is just to check when the email has been sent by the site, and then the rest is to push into Data Layer for tracking and then redirect to thank you page upon completion.事件监听器只是检查站点何时发送了 email,然后将 rest 推送到数据层进行跟踪,然后在完成后重定向到感谢页面。

In my opinion this is definitely not a CORS related error in the sense that the request is coming from our local script with the correct headers.在我看来,这绝对不是与CORS相关的错误,因为请求来自我们的本地脚本并带有正确的标头。 Code works in all other browsers with no issue.代码在所有其他浏览器中都可以正常工作。

Firefox has this page https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSDidNotSucceed to try to explain why we're getting the error: Firefox 有这个页面https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSDidNotSucceed试图解释为什么我们会收到错误:

Reason 1:原因一:

Its Certificate error: Its Google, it's not a cert error它的证书错误:它的谷歌,它不是一个证书错误

Reason 2:原因2:

HTTP to HTTPS request: HTTPS on site with Let's Encrypt SSL HTTP 到 HTTPS 请求:HTTPS 在现场使用 Let's Encrypt ZEA52C3624425C5F91C23Z3

Reason 3:原因3:

Not permitted to access localhost: This isn't localhost and is live site不允许访问本地主机:这不是本地主机,而是实时站点

Reason 4:原因4:

Server didn't respond: Again, it's Google, it responds to everything.服务器没有响应:再次,它是谷歌,它响应一切。

TLDR: Firefox is blocking datalayer push when Enhanced Privacy is turned on, but should be allowing a standard conversion tracking script to run in line with their own docs. TLDR:Firefox 在启用增强隐私时阻止数据层推送,但应该允许标准转换跟踪脚本按照他们自己的文档运行。 Why is it blocking us and what code do I need to get around it?为什么它会阻止我们,我需要什么代码来绕过它?

UPDATE更新

I've found this link https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Privacy/Tracking_Protection which says:我发现这个链接https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Privacy/Tracking_Protection说:

How does Firefox choose what to block? Firefox如何选择挡什么?

Content is blocked based on the domain from which it is to be loaded.内容根据要加载的域被阻止。

Firefox ships with a list of sites which have been identified as engaging in cross-site tracking of users. Firefox 附带一个已被确定为从事跨站点用户跟踪的站点列表。 When tracking protection is enabled, Firefox blocks content from sites in the list.启用跟踪保护后,Firefox 会阻止列表中站点的内容。

Sites that track users are most commonly third-party advertising and analytics sites .跟踪用户的网站最常见的是第三方广告和分析网站

Is Firefox seriously blocking Google Analytics on standard conversion tracking now? Firefox 现在是否在标准转换跟踪上严重阻止了 Google Analytics?

It looks like I was correct with my original assumptions, to a certain degree.在某种程度上,我最初的假设似乎是正确的。 Firefox isn't blocking all analytics access by default now, but it is blocking anything ad related that tries to send conversion or tracking code related to ads. Firefox 现在默认情况下不会阻止所有分析访问,但它会阻止任何与广告相关的尝试发送与广告相关的转化或跟踪代码的内容。

So, if you're trying to fire a goal upon completion of an ad related activity, it's going to get blocked, whilst other tracking related scripts will get run.因此,如果您试图在完成与广告相关的活动后触发目标,它将被阻止,而其他与跟踪相关的脚本将被运行。

Firefox has chosen its own list of what it believes to be third party tracking scripts and by default, its blocking them all now. Firefox 已经选择了它自己认为是第三方跟踪脚本的列表,默认情况下,它现在将它们全部阻止。

Interesting Points有趣的点

Google obviously relies on this tracking conversion data and as such Chrome is quite far behind in implementing anything to block ad related traffic, its where they make their money so it wouldn't make sense to block themselves.谷歌显然依赖于这种跟踪转换数据,因此 Chrome 在实施任何阻止与广告相关的流量方面都远远落后,这是他们赚钱的地方,所以阻止自己是没有意义的。 They currently have over 60% market share in regard to usage ( https://en.wikipedia.org/wiki/Usage_share_of_web_browsers ) so your tracking is going to be ok for now.他们目前在使用方面拥有超过 60% 的市场份额( https://en.wikipedia.org/wiki/Usage_share_of_web_browsers ),所以您的跟踪现在可以了。

However, both Safari and Firefox, neither of which rely upon ad revenue have implemented strict measures for tracking.但是,依赖广告收入的Safari和Firefox都没有实施严格的跟踪措施。

Safari & Firefox Safari & Firefox

Firefox goes all out and blocks tracking scripts related to third party sources. Firefox 全力以赴并阻止与第三方来源相关的跟踪脚本。 Take note of the 'third party', its when an advertiser is embedding their script on your site.请注意“第三方”,即广告客户将其脚本嵌入您的网站时。

Safari, on the other hand has gone a step further and will auto delete ALL tracking related cookies after 7 days of not being on the site.另一方面,Safari 更进一步,将在 7 天不在网站后自动删除与 cookies 相关的所有跟踪。 This is going to knock your data way off as although it will still show visitors, they'll show as new visitors instead of returning visitors .这将关闭您的数据,因为尽管它仍会显示访问者,但他们将显示为新访问者而不是回访者

Conclusion结论

Right now, I feel like this is the beginning of the end of traditional conversion and ad tracking for website owners and something is due to change in the near future as these browser changes start to bite.现在,我觉得这是网站所有者传统转换和广告跟踪结束的开始,随着这些浏览器的变化开始产生影响,在不久的将来会发生一些变化。

I don't know of any way to get around this for now.我现在不知道有什么办法可以解决这个问题。 I explored trying to use a proxy to get around the tracking embeds, but without knowing how and what Google tracks on each script call, it was impossible to spoof the submissions to analytics.我探索了尝试使用代理来绕过跟踪嵌入,但不知道 Google 在每个脚本调用上如何跟踪以及跟踪什么,就不可能欺骗提交到分析。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM