Google Analytics(分析) - 跟踪单个HTTP请求中的多个事件 [英] Google Analytics - track multiple events in single HTTP request

查看:146
本文介绍了Google Analytics(分析) - 跟踪单个HTTP请求中的多个事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要跟踪该项目在搜索结果中出现的次数(在Web应用程序中)。即用户搜索一些东西并获得前20项 - 跟踪每项20项的1次访问。
在另一个页面上,用户可以看到项目的统计信息 - 它在搜索结果中显示了多少次。

I need to track how many times the item is present in search results (in web application). I.e. user search something and get first 20 items - 1 visit for each of 20th items is tracked. On another page user can see statistic for item - how many times it was shown in search results.

我考虑使用 Google Analytics事件跟踪。例如。来自Javascript:

I consider usage of Google Analytics Event Tracking for that task. E.g. from Javascript:

ga('send', 'event', {
    eventCategory: 'item-category',
    eventAction: 'search',
    eventLabel: 'item-id',
});

但不幸的是Google Analytics API允许每个HTTP请求只注册1个事件。这意味着每个搜索都会发送20个以上的HTTP请求。对于我们的要求,这是非常无效的。

But unfortunately Google Analytics API allows to register only 1 event per 1 HTTP request. It means that for every search 20+ HTTP requests will be send. That's pretty ineffective for our requirements.

我寻找解决方法:
$ b

I looked for workarounds:


  1. < a href =https://developers.google.com/analytics/devguides/collection/protocol/v1/reference =nofollow noreferrer> Measurement protocol 允许发送直接的HTTP请求,但GET和 http://www.google-analytics.com/collect 的POST版本只注册单个事件每次请求。

  2. Google中的批处理数据可能会有所帮助,但GData 看起来已经过时,我不是确定它是否支持Google Analytics事件数据。它看起来相当重量级的实验。

  3. 管理API 报告API 不支持上传事件数据。

  4. ga.js(Google Analytics(分析)追踪的先前版本)无法实现:

  1. Measurement protocol allows to send direct HTTP requests, but both GET and POST versions of http://www.google-analytics.com/collect registers only single event per request.
  2. Batch Processing in Google Data might help, but GData looks obsolete and I am not sure if it supports Google Analytics Events data. It looks quite heavyweight for experiments.
  3. Management API and Reporting API does not support uploading of events data.
  4. It is not possible with ga.js (previous version of Google Analytics Tracking): Post Multiple Events within One HttpRequest to Google Analytics

是否可以针对每个HTTP请求注册多个Google Analytics事件?

Is it possible to register multiple Google Analytics events per 1 HTTP request?

推荐答案

无法跟踪多个GA事件与单个HTTP请求。

It is not possible to track multiple GA events with single HTTP request.

最后,我通过 Measurement Protocol 。每个事件对GA服务器仍有1个HTTP请求,但不会影响最终用户。

Finally, I implement server side event registration via Measurement Protocol. There is still 1 HTTP request to GA servers per event, but it does not affect end users.

这篇关于Google Analytics(分析) - 跟踪单个HTTP请求中的多个事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆