如何通过 Angular 5 在单个页面中获取多个标签的 Google Analytics



我能够获得路线的谷歌分析,如果我们导航不同的路线,它可以工作,但在页面中我有多个选项卡。 我想要基于标签的谷歌分析导航。 请参考以下上传图片以供参考。提前谢谢你

ga('create', 'UA-XXXXXX-Y', {'userId': customUserId}(;//如果"用户 ID"功能可用 GA("要求"、"显示功能"(; ga('set', 'dimension1', customUserId(;在页面级别设置customUserId维度 GA("发送"、"网页浏览"(;在此处输入图像描述

您必须为此捕获自定义事件

//Function in service.ts file  
googleEventTrack(eventCategory,eventLabel,eventAction,eventValue) {
(<any>window).ga('send', 'event', {
eventCategory: eventCategory,
eventLabel: eventLabel,
eventAction: eventAction,
eventValue: eventValue
});

}

//capture event on button click in component.ts
btnClick(){
this.CommonService.googleEventTrack('eventCategory', 'eventLabel',
'eventAction', 'eventValue');
}

最新更新