Angulartics2 Google Analytics(分析)保存网址名称

时间:2019-11-06 18:22:31

标签: angular typescript google-analytics angulartics2

我有此代码:

declare let gtag: Function;

@Component({
    selector: 'app-root',
    templateUrl: './root.component.html',
    styleUrls: ['./root.component.scss']
})
export class RootComponent {
constructor(public router: Router) {
    this.router.events.subscribe(event => {
        if (event instanceof NavigationEnd) {
            console.log(event);
            gtag('config', 'X-XXXXXX',
                {
                    page_path: event.urlAfterRedirects
                }
            );
        }
    });
}

} 当我查看Google Analytics(分析)时,我只会看到可视化的数量,没有路线名称。我想在Google Analytics(分析)中看到:/dashboard/dashboard/test。你能帮我吗?

0 个答案:

没有答案