[英]analytics.js Search Field Event Tracking
I am trying to track what a user is trying to search by in our app. 我正在尝试跟踪用户在我们的应用中要搜索的内容。 How do I go about doing this? 我该怎么做呢? This is what I have so far. 到目前为止,这就是我所拥有的。 Please let me know if there is a better way to achieve this. 请让我知道是否有更好的方法来实现这一目标。 I cannot get the bottom to work as it is not tracking any of this info. 我无法深入研究,因为它没有跟踪任何此信息。
var myText = "Search Text";
ga('send', 'event', 'search-box-1', {
'Search Users': myText,
hitCallback: function() {
submitMyForm();
}
});
Instead of supplying 'Search Users'
as the key, use 'dimension1'
(or whatever index your CD is) to track myText
. 不用提供'Search Users'
作为关键字,而是使用'dimension1'
(或CD的任何索引)来跟踪myText
。 Google Documentation on Custom Dimension . 有关自定义维度的Google文档 。 You'll have to create the custom dimension within Google Analytics in Admin > Property > Custom Definitions > Custom Dimensions. 您必须在Google Analytics(分析)中的管理>属性>自定义定义>自定义维度中创建自定义维度。
Also, your hitCallback function, the key, needs some single quotes - Google Documentation on Hit Callback . 另外,您的hitCallback函数(该键)需要一些单引号- 有关Hit Callback的Google文档 。
var myText = "Search Text";
ga('send', 'event', 'search-box-1', {
'dimension1': myText,
'hitCallback': function() {
sumbitMyForm();
}
});
Use site search https://support.google.com/analytics/answer/1012264?hl=en 使用网站搜索https://support.google.com/analytics/answer/1012264?hl=zh_CN
Once you configure the parameter, GA will automatically aggregate keywords for your pageviews. 配置完参数后,Google Analytics(分析)将自动为您的综合浏览量汇总关键字。 No extra code required! 无需额外的代码!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.