内容安全政策可以与Google Analytics和AdSense兼容吗?

编程入门 行业动态 更新时间:2024-10-11 05:28:26
本文介绍了内容安全政策可以与Google Analytics和AdSense兼容吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有人知道如何通过默认src通配符获得CSP,以便现代Google Analytics脚本向网站所有者的帐户发送网站每页数据(不仅仅是主页数据),AdSense广告就会出现吗?

我为我的网站尝试了许多CSP版本,包括在< H5BP>的.htaccess文件中提出的CSP版本,页面数据(主页除外)和Google AdSense不接受任何网页上的广告。

Google的机器没有看到Google Analytics脚本,尽管Google的人员总是在我的视图中看到它网站源代码。即使将CSP default-src设置为星号通配符失败。

在Google论坛和非Google论坛上询问没有任何效果,只是人们说问题出在我的CSP和我收到一封电子邮件,说我应该完全评论CSP。最后的工作。注释掉应该不会比default-src通配符更好,但注释掉是我获得广告和网站内数据的唯一方式。

  • 大约一个月前,我在Google上发布了有关不兼容性的问题,但没有人回答这个问题( www.en.advertisercommunity/t5/Code-Implementation/content-security-policy-and-Analytics-and可能是AdSense / mp / 491031 )。
  • Google Analytics和内容安全策略标题>< Google Analytics和Content-Security-Policy标题>> stackoverflow/questions/30939809/google-analytics-js-and-content-security-policy\">Google analytics.js和内容安全政策>适用于应用程序,而不是网站,没有人报告过获取网站内部的Google Analytics数据,即使采用最大限度允许的CSP,我的努力也失败了。

    解决方案位于线程< 谷歌分析通用代码无法跟踪>但解决方案仅限于将CSP设置为报告,而不是阻止,这对我没有多大用处。

没有堆栈溢出线程是关于CSP和AdSense。当我提议H5BP在他们的模型<。htaccess>中告诉用户这件事时,他们的受访者表示它适合他并将我介绍给你。

建议,是否有人在自己的Google Analytics帐户中看到特定页面的数据,并在运行.htaccess CSP时看到AdSense广告? >无。截至今天[9月8日]。我们禁用了CSP,因为Google框架来源特定于域 - > frame-src:... google.co.uk google.co.fr ...

Does anyone know how to get CSP, even with the default-src wildcard, to work so a modern Analytics script sends website per-page data (not just home page data) to the site owner's account and so AdSense ads appear?

I tried many variations of CSP for my website, including that proposed in <H5BP>'s .htaccess file, but all blocked Google Analytics from producing per-page data (except for the home page) and Google AdSense from accepting ads on any page.

Google's machines did not see the Analytics script although Google's humans always saw it in my website source code. Even setting CSP default-src to the asterisk wildcard failed.

Asking at a Google forum and a non-Google forum got nothing that worked except that people said the problem was with my CSP and I received one email that said that I should comment CSP out completely. That last worked. Commenting out should be no better than default-src wildcard but commenting out is the only way I got ads and inside-the-website data.

  • I posted to Google about a month ago about the incompatibility but no answer refuted that (www.en.advertisercommunity/t5/Code-Implementation/content-security-policy-and-Analytics-and-likely-AdSense/m-p/491031).

  • The Stack Overflow answers at <Google Analytics and Content-Security-Policy header > do not indicate that anyone is getting within-website Analytics data and that thread is based on an outdated Google script.

  • The thread at <Google analytics.js and Content Security Policy > is for an app, not a website, no one there reported getting within-website Analytics data, and my efforts failed even with the maximally permissive CSP.

  • A solution is in the thread <Google analytics Universal code not tracking > but the solution is limited to setting CSP to reporting, not blocking, which is not of much use to me.

No Stack Overflow thread is about CSP and AdSense. When I proposed that H5BP tell users about this in their model <.htaccess>, their respondent said it works for him and referred me to you.

As a check on advice, is anyone seeing that page-specific data in their own Google Analytics account and seeing AdSense ads while running .htaccess CSP?

解决方案

No. As of today [8 Sep 16]. We disabled CSP as Google frame source was domain specific -> frame-src : … google.co.uk google.co.fr ...

更多推荐

内容安全政策可以与Google Analytics和AdSense兼容吗?

本文发布于:2023-11-02 05:59:36,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:政策   内容   Google   Analytics   AdSense

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!