Google Analytics analytics.js匿名评分报告

时间:2021-04-30 15:15:49

So I'm trying to set up Google Analytics for my web game. I need to send over a score and I've gotten that working, but the problem is when I test the game and check my custom report the next day then I see only one entry and it seems like it just added up all the scores and put them into one entry. I believe the solution is to use dimensions to make multiple entries. Here's what I have right now for sending over data to analytics.

所以我正在尝试为我的网页游戏设置Google Analytics。我需要发送一个分数,我已经得到了工作,但问题是当我测试游戏并在第二天检查我的自定义报告然后我只看到一个条目,似乎它只是加起来所有的分数和把它们放在一个条目中。我相信解决方案是使用维度来创建多个条目。以下是我现在用于将数据发送到分析的内容。

var rid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
    return v.toString(16);
});

// send over relevant analytics data to Google Analytics
ga('set', 'dimension1', rid);
ga('set', 'metric1', NJ.analytics.blocksCleared);
ga('send', 'event', 'Game', 'end', 'Game Session Data');

I'm not sure if this is the correct solution and it might also create duplicate data since I'm just generating a random string. Can someone confirm that this is how you generate rows of custom variables in analytics.js and suggest a better method of generating unique anonymous users for analytics.js?

我不确定这是否是正确的解决方案,它也可能会创建重复数据,因为我只是生成一个随机字符串。有人可以确认这是您在analytics.js中生成自定义变量行的方法,并建议为analytics.js生成唯一匿名用户的更好方法吗?

1 个解决方案

#1


0  

Having a single row for each score is not very helpful by itself. If you still want to do it though, custom dimensions is the way to go. I am not sure if that is going to provide the data you need though.

每个分数只有一行并不是很有帮助。如果你仍然想要这样做,自定义尺寸是要走的路。我不确定这是否会提供您需要的数据。

The primary question is: What do you want to do with the data you are collecting? If you are interested in the average of scores, you can look at event value field.

主要问题是:您要对要收集的数据做什么?如果您对分数的平均值感兴趣,可以查看事件值字段。

Custom metrics by definition are aggregates and will result in a single value over a period.

根据定义,自定义指标是聚合,并且将在一段时间内产生单个值。

#1


0  

Having a single row for each score is not very helpful by itself. If you still want to do it though, custom dimensions is the way to go. I am not sure if that is going to provide the data you need though.

每个分数只有一行并不是很有帮助。如果你仍然想要这样做,自定义尺寸是要走的路。我不确定这是否会提供您需要的数据。

The primary question is: What do you want to do with the data you are collecting? If you are interested in the average of scores, you can look at event value field.

主要问题是:您要对要收集的数据做什么?如果您对分数的平均值感兴趣,可以查看事件值字段。

Custom metrics by definition are aggregates and will result in a single value over a period.

根据定义,自定义指标是聚合,并且将在一段时间内产生单个值。