跟蹤我已經安裝瀏覽量下方角2 &跟蹤是我的代碼,但不知道如何設置事件跟蹤:安裝谷歌分析事件具有角2
// app.component.ts -> this is working fine
declare let ga:Function;
export class App {
constructor(public router: Router) {
this.router.events.subscribe((event:Event) => {
if(event instanceof NavigationEnd) {
ga('send', 'pageview', event.urlAfterRedirects);
}
});
}
}
上面的代碼獲取頁面視圖工作正常,但不低於事件跟蹤代碼
// spreadsheet.component.ts
declare let ga:Function;
updateContact(contact) {
// http call
.....
// On success, this should get fired
ga('send', 'event', 'update_contact', 'update', 'Update contact requested');
}
我也沒有收到任何錯誤或警告,只是這個事件沒有得到註冊。
安裝適用於Chrome的GA調試器,以查看事件是否經過,或者檢查您的開發控制檯或實時報告 – nyuen