如何获得用户上网统计信息? [英] How to get user surfing statistics?

查看:169
本文介绍了如何获得用户上网统计信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题与获取Google标签管理器收集的用户数据相关,以使其更具体。



我有一个Ruby-on-Rails Web应用程序。假设有些用户来到我的网站,浏览了几页,然后通过反馈表向我发送了反馈。有什么方法可以收集这样的信息:


  • 哪些关键字将用户引导至我的网站

  • 他在我的网站上访问了多少页面以及有多长时间

  • 其他任何浏览统计信息,这可能很有趣



以便将它与此反馈一起发送?

我有一个收集此类信息的Google跟踪代码管理器,但它自动发送到我的Google帐户,而我找不到任何API来获取它以反馈信息。

首先,您必须认为Google Analytics有数据,所以第一个问题是如何提取谷歌分析的数据?您可以使用Google Analytics(分析)API,在这里查看实施详情:如何提取Google Analytics统计信息?



接下来的问题是要发送给谷歌分析的数据能够识别特定用户的数据?那么,这很简单,只需发送用户ID即可。但是......你不能这样做,因为它不被谷歌分析所允许。但你可以发送HASHED用户ID。所以你可以做的是发送一个自定义维哈希用户id ,并且还有一个自定义维 Page Type 价值反馈。然后,如果您想了解诸如每位用户反馈的会话持续时间等信息,您可以执行以下操作:

 维度:哈希用户id 
指标:会话持续时间
过滤器:'页面类型'确切'反馈'



<它会返回类似于:

 散列用户ID |期限
eoqi456dsa46wc | time1
hashed9877ad8c | time2






编辑:要发送用户ID,您必须包含以下JavaScript片段: ga('set','hashed_user_id',<%= current_user.id%>);



因此,您的反馈意见可能如下所示:

 < script> 
ga('set','hashed_user_id',<%= current_user.id%>);
ga('set','页面类型','反馈');
ga('send','pageview');
< / script>

<%=呈现'feedback / form'%>

请注意,如果您想跟踪回答反馈的人,那么您可能需要将 ga('set','Page Type','回答'); ,并将jascript放在成功页面上。


This question is connected with Get user data collected by Google tag manager in order to make it more concrete.

I have a Ruby-on-Rails web application. Assume, that some user comes to my site, surfs several pages and then sends me a feedback through feedback form. Is there any way to gather such information like:

  • which keywords led user to my site
  • what pages did he visited on my site and for how long
  • any other surfing statistics, that could be interesting

in order to send it together with this feedback?

I have a Google Tag Manager which gathers such information but it sends automatically to my google account and I can't find any API to get it in order to attach to feedback.

解决方案

First, you have to think that google analytics has the data, so the first question is how to extract google analytics' data ? You can use Google analytics API, see here on implementation details : How to pull Google Analytics stats?

The question then is what data to send to google analytics to be able to identify data for a specific user ? Well, that's simple, just send the user id. But ... you can't because it's not allowed by google analytics. BUT you CAN send a HASHED user id. So what you can do is send a custom dimension hashed user id and also have a custom dimension Page Type which takes the value "feedback". Then if you want to know things such as the session duration per user who went to feedback you can do:

Dimensions : Hasher user id
Metrics : session duration
Filters : 'Page Type' exact 'feedback'

It will return something like :

Hashed user id | duration
eoqi456dsa46wc |   time1
hashed9877ad8c |   time2


Edit : To send the user id, you have to include this javascript snippet: ga('set', 'hashed_user_id', <%= current_user.id %>);

So maybe your view for your feedback will be something like this:

<script>
  ga('set', 'hashed_user_id', <%= current_user.id %>);
  ga('set', 'Page Type', 'Feedback');
  ga('send', 'pageview');
</script>

<%= render 'feedback/form' %>

Please note that if you want to track people who ANSWERED the feedback then you might want to put ga('set', 'Page Type', 'Feedback answered'); for instance and put the jascript on the success page.

这篇关于如何获得用户上网统计信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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