简体   繁体   English

跟踪Google Analytics中第三方插件的加载时间

[英]tracking loading times of 3rd party plugins in google analytics

I am using a 3rd party plugin service (POWr.io) to add elements to our online store built using Shopify. 我正在使用第三方插件服务(POWr.io)向使用Shopify构建的在线商店添加元素。 The plugin does not support script tags, so I was unable to add tags using the Google Tag Manager 该插件不支持脚本代码,因此我无法使用Google跟踪代码管理器添加代码

I use a variety of plugins from this service, and I would like to be able to collect data on them, specifically measuring loading time for photo galleries, and setting up goals in Google Analytics for newsletter submissions. 我使用此服务中的各种插件,我希望能够收集这些插件的数据,特别是测量照片库的加载时间,并在Google Analytics中设置提交新闻稿的目标。

I can add custom JS directly into the individual plugins (in this case a photo gallery), and I have loaded the Google Analytics Tracking Code Snippet successfully. 我可以将自定义JS直接添加到各个插件中(在本例中为照片库),并且我已成功加载Google Analytics跟踪代码段。 I am currently using ga('send', 'pageview'); 我目前正在使用ga('发送','pageview'); but I think I need to use a different command to collect loading time, I have tried following what is written here 但我想我需要使用不同的命令来收集加载时间,我已经尝试过按照这里写的内容

However, I am not sure how to modify: 但是,我不知道如何修改:

ga('send', 'timing', [timingCategory], [timingVar], [timingValue], [timingLabel], [fieldsObject]);  

To get the results I need and into Google Analytics. 要获得我需要的结果并进入Google Analytics。

Likewise, for a form submission, I imagine I would need to use this: 同样,对于表单提交,我想我需要使用它:

ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);

But, again, not sure what how to modify this for my use in a plugin. 但是,再次,不知道如何修改这个以供我在插件中使用。

Any advice anyone could offer would be greatly appreciated 任何人都可以提供的建议将不胜感激

To measure timing events you need to create a timestamp when the event starts, another when it ends, and the difference between the two you pass in as timing value. 要测量定时事件,您需要在事件开始时创建时间戳,在事件开始时创建另一个时间戳,并将两者之间的差异作为时间值传入。

timingCategory, timingVar and timingLabel are just arbitrary strings that appear as dimensions in your reports (like category, action and label in event tracking). timingCategory,timingVar和timingLabel只是在报表中显示为维度的任意字符串(如事件跟踪中的类别,操作和标签)。

timingValue is: timingValue是:

timingValue integer yes The number of milliseconds in elapsed time to report to Google Analytics (eg 20). timingValue integer yes报告给Google Analytics(例如20)所用时间的毫秒数。

With user timings GA is not doing the actual measuring for you, you need to determine the time yourself and put it in as a metric. 由于用户时间GA没有为您进行实际测量,您需要自己确定时间并将其作为指标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM