I'm using Google Analytics (analytics.js) to track site searches on my website:
我正在使用Google Analytics(analytics.js)跟踪我网站上的网站搜索:
ga('send', 'pageview', '?q=' + search_term);
As you can see I'm using pageview
as the hit type. My problem is, I don't want a new page view to be recorded each time a user performs a search on my site.
正如您所看到的,我正在使用pageview作为匹配类型。我的问题是,每次用户在我的网站上执行搜索时,我都不希望记录新的页面视图。
Is it possible to track site search and not have each search count as a separate page view? If so, how can this be done?
是否可以跟踪网站搜索,而不是将每个搜索计数作为单独的页面视图?如果是这样,怎么办呢?
1 个解决方案
#1
Unfortunately, filtering out these Pageviews will stop Analytics from processing them further down its pipeline, which will not allow you to track Search Terms.
不幸的是,过滤掉这些网页浏览量会阻止Google Analytics在其管道中进一步处理,这将无法跟踪搜索字词。
You could create a separate View for your Property, which filters out pages whose URL start with ?q=
.
您可以为属性创建单独的视图,该视图会过滤掉URL以?q =开头的网页。
That would allow you to track the Search Terms entered in your website and retain an overview of your website without the "inflated" Pageviews/Virtual Pageviews of search -- I presume you might be using an Ajax Search on your site?.
这样您就可以跟踪在您的网站中输入的搜索字词,并保留您网站的概述,而不会显示“虚增”的网页浏览量/搜索虚拟网页浏览量 - 我认为您可能在您的网站上使用了Ajax搜索?
#1
Unfortunately, filtering out these Pageviews will stop Analytics from processing them further down its pipeline, which will not allow you to track Search Terms.
不幸的是,过滤掉这些网页浏览量会阻止Google Analytics在其管道中进一步处理,这将无法跟踪搜索字词。
You could create a separate View for your Property, which filters out pages whose URL start with ?q=
.
您可以为属性创建单独的视图,该视图会过滤掉URL以?q =开头的网页。
That would allow you to track the Search Terms entered in your website and retain an overview of your website without the "inflated" Pageviews/Virtual Pageviews of search -- I presume you might be using an Ajax Search on your site?.
这样您就可以跟踪在您的网站中输入的搜索字词,并保留您网站的概述,而不会显示“虚增”的网页浏览量/搜索虚拟网页浏览量 - 我认为您可能在您的网站上使用了Ajax搜索?