首页 文章

如何使分析在manifest 2.0中运行

提问于
浏览
0

我想知道如何使其工作,因为只是粘贴应用程序中的代码不起作用 .

分析生成的代码是这样的:

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXXX-X', 'auto');
ga('send', 'pageview');
  • 所以,我试着配置这个:

"content_security_policy":“script-src 'self' http://www.google-analytics.com; object-src 'self'”

但它不起作用,因为“content_security_polict”只接受HTTPS而不接受HTTP .

  • 我也尝试在"permission"中配置路径:

{... "permissions":[“https://www.google-analytics.com/analytics.js”] ......}

但它也不起作用 .

  • 我尝试在分析代码中设置HTTPS固定,但也不起作用 .

在普通网页中,它会加载两个文件:

enter image description here

但在我的应用程序中,它只加载一个:

enter image description here

我怎样才能使它有效?

1 回答

相关问题