Chrome 扩展程序中的 Google Analytics
Google Analytics in Chrome Extension
在Google Analytics上,我没有在Chrome扩展程序中看到我的自定义跟踪事件。
我的内容脚本向 bg 页面发送一条消息,如下所示:
chrome.extension.sendRequest({message: "report"}, function(response) {});
我的 bg.js 包含以下内容:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-57683948-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = 'https://ssl.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
function cEvent(){
_gaq.push(['_trackEvent', 'reported']);
console.log("got this far");
}
chrome.extension.onRequest.addListener(
function(request, sender, sendResponse) {
console.log(sender.tab ?
"from a content script:" + sender.tab.url :
"from the extension");
if (request.message == "report")
cEvent();
});
自4天前添加此代码以来,Google Analytics每天都会收到新数据。它正在正确注册页面浏览量,但我在任何地方都没有看到我的自定义事件"报告"。我知道正在调用该函数,因为我在控制台中看到我的"到目前为止"。但是跟踪事件没有发送吗?
_trackEvent至少有
2 个必需的参数。尝试将其替换为:
_gaq.push(['_trackEvent', 'reported', 'reported']);
相关文章:
- 在Google Analytics中跟踪用户,但只能在两个操作之间跟踪
- 如何使用Google Analytics跟踪表单提交
- 创建类似于Google analytics的分析地图
- 如何将Google Analytics配置为将URL参数作为单个页面进行跟踪
- 从Google Analytics文档中重新创建滚动效果
- 将javascript与PHP混合?(跟踪Google Analytics虚拟页面浏览量)
- 使用Google Analytics API的区域图-未采集类型错误无法读取'库'的未定义
- 如何将Google Analytics集成到GWT应用程序中
- 在javascript客户端和java服务器之间共享Google Analytics ClientID
- 2个Analytics帐户中的Google Analytics事件触发器跟踪
- 使用AddThis-config-data_ga_property向两个Google Analytics配置文件报告
- Google Analytics setup (advanced Javascript)
- Google Analytics(分析)多跟踪帐号维度数据部分未显示在报告中
- 检查Google Analytics是否已加载并调用ga('create',..)
- 如何在chrome扩展中加载Google Analytics和Facebook SDK
- 在 301 重定向期间,Google Analytics cookie _ga会发生什么情况
- 将JS变量作为文本返回以发送到Google Analytics
- 将Google Analytics添加到空网站
- 具有用户范围的Google Analytics自定义维度使用情况
- Google Analytics的多域跟踪