简体   繁体   中英

angulartics2 event does not work

I am using angulartics2 .

import { Component } from '@angular/core';
import { Angulartics2On } from 'angulartics2';

@Component({
  selector: 'random-component',
  directives: [Angulartics2On],
  template: `
    <button angulartics2On angularticsEvent="Play" angularticsCategory="Videos" (click)="onClick()">Play</button>
  `
})
export class RandomComponent {
  onClick() {
    console.log('Hi');
  }
}

does not work for me. The effect does not show in the Google Analytics Debugger and Google Analytics Real-Time reports.

What may cause this? Thanks

I got answer from @JonnyBGod on github, and thanks!

I need change angulartics2On to angulartics2On="click" .

But since this PR , in v1.1.1, we are able to use angulartics2On only, the default event will be click .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM