Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google chrome extension 谷歌Chrome应用分析_Google Chrome Extension_Google Analytics_Google Chrome App - Fatal编程技术网

Google chrome extension 谷歌Chrome应用分析

Google chrome extension 谷歌Chrome应用分析,google-chrome-extension,google-analytics,google-chrome-app,Google Chrome Extension,Google Analytics,Google Chrome App,情况: 我想从具有以下URL的chrome应用程序中跟踪事件 铬-extension://APP_ID. 在Google Analytics网页中,唯一受支持的协议是http和https 我刚刚输入了一个随机的网址为网站网址现在。我还正确设置了清单: "permissions": ["webview", "browser", "http://www.youtube.com/*", "https://www.youtube.com/*", "https://fonts.googleapis.c

情况:

我想从具有以下URL的chrome应用程序中跟踪事件

铬-extension://APP_ID.

在Google Analytics网页中,唯一受支持的协议是http和https

我刚刚输入了一个随机的网址为网站网址现在。我还正确设置了清单:

"permissions": ["webview", "browser", "http://www.youtube.com/*",
  "https://www.youtube.com/*", "https://fonts.googleapis.com/*",
  "https://www.google-analytics.com/*", "https://ssl.google-analytics.com/", "storage", "notifications
 ],
"sandbox": {
  "pages": ["sandbox/sandbox.html"]
},
然后,在我的应用程序中,当应用程序在沙箱中启动时,我会执行以下操作:

(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','https://ssl.google-analytics.com/analytics.js','ga');

ga('create', 'UA-TRACKING-ID', 'auto');
ga('set', 'checkProtocolTask', null); // Removes failing 
ga('send', 'pageview');
问题:

分析页面没有显示任何事件,因此我假设正确设置默认url实际上可能很重要。我应该如何从我的Chrome应用程序跟踪事件

更新:

我看到以下请求被触发

" -H'Pragma:no cache'-H'Accept编码:gzip,deflate,sdch'-H'Accept语言:en-US,en;q=0.8,ko;q=0.6'-H'用户代理:Mozilla/5.0 麦金塔英特尔Mac OS X 10_11_2 AppleWebKit/537.36 KHTML,如 Gecko Chrome/49.0.2623.87 Safari/537.36'-H'接受: image/webp,image/,/*;q=0.8'-H'缓存控制:无缓存'-H'- “连接:保持活力

这是否意味着我正确发送谷歌分析请求?我需要等几天才能看到第一次更新吗?

请注意,目前有一个指向特殊库的链接,它可以为您处理大部分设置,而无需使用沙箱之类的技巧

但是,对于问题中最相关的部分,您试图创建错误的属性类型。即使这不是直观的,你也需要这样做。在这里,您不需要提供URL。这也是其中的一部分


哦,因为URL仍然是特殊的,所以发送页面视图对它不起作用。使用上面的库,sendAppView是一个不错的选择;否则,您可以随时发送自定义事件。

Hey@Xan,我很高兴您能回答,因为您之前关于制作chrome扩展的回答绝对有用。让我添加一个更新。另外,我在我的应用程序中使用了沙盒,所以我可以将代码粘贴到沙盒中。但我不明白为什么在我的Google Analytics仪表板中看不到跟踪结果。尝试观察实时视图。我正在查看实时视图,但没有看到任何结果。你有什么想法吗?我想pageview很可能是Chrome应用程序的无效事件。尝试一个自定义事件,或者,如果您正在使用我提到的库,请尝试。确保你有一个移动应用程序属性。就是这样。你能补充一下页面浏览不适用于Chrome应用程序吗?我会接受你的回答。