简体   繁体   English

如何将Google Analytics(分析)事件标签添加到Angulartics2?

[英]How to add Google Analytics event label to Angulartics2?

In Angulartics2 , how do you pass the event label to Google Analytics? Angulartics2中 ,如何将事件标签传递给Google Analytics(分析)?

Currently I have this code: 目前,我有以下代码:

<a type="button" [routerLink]="['SecondPage']" angulartics2On="click" angularticsCategory="Click" angularticsEvent="Homepage">Click me</a>

When using the Analytics debugger for Chrome, it shows an event being fired which passes category and action. 在使用适用于Chrome的Google Analytics(分析)调试器时,它会显示一个触发事件,该事件传递了类别和操作。 Looking at the code in GitHub makes it look like it is possible to supply a label, but I'm not clear what attribute needs adding to the anchor tag? 通过查看GitHub中的代码,可以提供标签,但是我不清楚需要将哪些属性添加到锚标签中? angularticsLabel doesn't appear to have any effect. angularticsLabel似乎没有任何作用。

Try to use the angularticsProperties parameter 尝试使用angularticsProperties参数

angularticsProperties="{label: 'some label'}"

cf. cf. https://github.com/angulartics/angulartics2/issues/22 https://github.com/angulartics/angulartics2/issues/22

另一个答案提供了正确的方法,但是由于代码中eval ,因此也有必要将Object文字用括号括起来

angularticsProperties="({label: 'some label'})"

The new version now (1.1.9) is: 现在的新版本(1.1.9)为:

[angularticsProperties]="{label: 'YourLabel'}"

I just udpated README file by a PR here . 我只是在这里通过PR修改了README文件。

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

相关问题 角度angulartics2(谷歌分析)不会更新路线更改页面 - Angular angulartics2 (google analytics) does not update page on route change angulartics2 自定义事件发送到 facebook 但不发送到谷歌分析 - angulartics2 custom events are sent to facebook but not to google analytics angulartics2事件不起作用 - angulartics2 event does not work Angulartics和Google分析 - Angulartics and Google analytics Angulartics2初始设置 - Angulartics2 initial setup 我如何通过angulartics2跟踪`ecommerce:addItem`或`ecommerce:addTransaction`? - How I can track `ecommerce:addItem` or `ecommerce:addTransaction` by angulartics2? Angulartics和Google Analytics(分析)自定义报告 - Angulartics and Google Analytics custom reports 如何在Angulartics2 eventTrack(this.angulartics2.eventTrack.next({action:&#39;myAction&#39;,properties:{myproperties})中传递电子商务对象? - How to pass ecommerce object in Angulartics2 eventTrack(this.angulartics2.eventTrack.next({ action: 'myAction', properties: {myproperties})? 如何在使用Angletics时关闭Google Analytics(分析) - how do I turn off google analytics while using angulartics 如何使用Angulartics在Google Analytics中设置自定义维度 - How to set Custom Dimension in Google Analytics using Angulartics
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM