谷歌分析 - hearthbeat,在HTML5游戏中保持活跃的访客

时间:2022-05-25 03:12:38

I have online HTML5 game, with many players, but I have problem with goole analytics.

我有在线HTML5游戏,有很多玩家,但我有goole分析的问题。

Count of online users not equal to total players on my servers. Google analytics kill after few minutes session and user disapere from google analtyics (real time), but I want see in google analytics real online users.

在线用户数不等于我服务器上的总玩家数。谷歌分析会在几分钟的会话和用户从谷歌分析(实时)消失后终止,但我希望在谷歌分析真正的在线用户中看到。

Is there any method like heartbeat ? I found only this:

有心跳的方法吗?我发现只有这个:

        function ga_heartbeat(){
          _gaq.push(['_trackEvent', 'Heartbeat', 'Heartbeat', '', 0, true]);
          setTimeout(ga_heartbeat, 5*60*1000);
        }
        ga_heartbeat();

Unfortunely it's not working, I also try set life of session to 2 hours, same problem.

不幸的是它不起作用,我也尝试将会话时间设置为2小时,同样的问题。

Another solution can be send every 5 minutes pageview, but it will ruin other statistics.

另一种解决方案可以每5分钟发送一次综合浏览量,但会破坏其他统计数据。

      ga('send', 'pageview');

How I can solve this problem ?

我怎么能解决这个问题?

1 个解决方案

#1


0  

Update your "heartbeat" to use Universal Analytics syntax:

更新“心跳”以使用Universal Analytics语法:

  function ga_heartbeat(){
          ga('send','event','<category>','<name>')
          setTimeout(ga_heartbeat, 5*60*1000);
        }
        ga_heartbeat();

Where category and name are placeholders.

类别和名称是占位符。

Since this is a game and people are presumably making progress you might want to send some game information with that event call instead of creating pointless data.

由于这是一款游戏,人们可能会取得进步,因此您可能希望通过该事件调用发送一些游戏信息,而不是创建无意义的数据。

Changing the session duration does not help (as you found out) since the time window for the realtime report works independently from the session settings.

更改会话持续时间没有帮助(如您所知),因为实时报告的时间窗口独立于会话设置工作。

#1


0  

Update your "heartbeat" to use Universal Analytics syntax:

更新“心跳”以使用Universal Analytics语法:

  function ga_heartbeat(){
          ga('send','event','<category>','<name>')
          setTimeout(ga_heartbeat, 5*60*1000);
        }
        ga_heartbeat();

Where category and name are placeholders.

类别和名称是占位符。

Since this is a game and people are presumably making progress you might want to send some game information with that event call instead of creating pointless data.

由于这是一款游戏,人们可能会取得进步,因此您可能希望通过该事件调用发送一些游戏信息,而不是创建无意义的数据。

Changing the session duration does not help (as you found out) since the time window for the realtime report works independently from the session settings.

更改会话持续时间没有帮助(如您所知),因为实时报告的时间窗口独立于会话设置工作。