【问题标题】:how to get google analytics for multiple tabs in a single page through angular 5如何通过 Angular 5 在单个页面中获取多个标签的谷歌分析
【发布时间】:2020-02-08 14:38:24
【问题描述】:

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

ga('create', 'UA-XXXXXX-Y', {'userId': customUserId}); // 如果“用户 ID”功能可用 ga('要求', '显示功能'); ga('set', 'dimension1', customUserId); // 在页面级别设置customUserId 维度 ga('发送', '浏览量');enter image description here

【问题讨论】:

    标签: angular google-analytics


    【解决方案1】:

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

    //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');
    }
    

    【讨论】:

      猜你喜欢
      • 2019-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-19
      • 2016-01-27
      • 2013-07-14
      • 1970-01-01
      相关资源
      最近更新 更多