How to set up page speed logging for google analytics in analytics.js

这一生的挚爱 提交于 2019-12-08 23:39:33

问题


Google released the new Analytics.js (https://developers.google.com/analytics/devguides/collection/analyticsjs/). I would like to use it, and I already have everyting set up just fine, apart from site speed.

In the "old" ga.js you could do this with

_gaq.push(['_setSiteSpeedSampleRate', 50]);

This would set it so 50% of the visitors would report sitespeed to analytics.

However, for the new analytics.js I cannot get it to work. I tried the following 2:

ga('send','setSiteSpeedSampleRate',50);
ga('setSiteSpeedSampleRate',50);

But no results. Any ideas?


回答1:


Ah, I found my answer. It now has to be set in the create method like this:

ga('create', 'UA-39262824-7', {'siteSpeedSampleRate': 100});

There are more fields that can be used there, found it here: Google Analytics Site Speed Sample Rate



来源:https://stackoverflow.com/questions/15901187/how-to-set-up-page-speed-logging-for-google-analytics-in-analytics-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!