[英]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'})"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.