如何通过angular 5在一个页面中获取多个标签的谷歌分析

如何通过angular 5在一个页面中获取多个标签的谷歌分析,angular,google-analytics,Angular,Google Analytics,我可以得到谷歌的路线分析,如果我们浏览不同的路线,它是工作,但在一个页面内,我有多个标签。我想要基于标签的谷歌分析导航。请参考下面的上传图片以供参考。先谢谢你 ga('create','UA-XXXXXX-Y',{'userId':customUserId});//如果“用户ID”功能可用 ga('require','displayfeatures'); ga('set','dimension1',customUserId);//在页面级别设置customUserId维度 ga(‘发送’、‘页面

我可以得到谷歌的路线分析,如果我们浏览不同的路线,它是工作,但在一个页面内,我有多个标签。我想要基于标签的谷歌分析导航。请参考下面的上传图片以供参考。先谢谢你

ga('create','UA-XXXXXX-Y',{'userId':customUserId});//如果“用户ID”功能可用 ga('require','displayfeatures'); 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');
}