angulartics2
angulartics2 copied to clipboard
Active page is being recorded as "/" instead of the whole URL and route changes are not recorded to Google Analytics
For support questions, please consider using Gitter - Chat
I'm submitting a ...
-
[* ] bug report
-
[ ] feature request
-
[ ] question about the decisions made in the repository
-
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
Browse directly to this URL: https://localhost/my-app/user/ae24b697-c5cc-46bc-9071-48b1083bc2b9
App Module
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component';
import { httpInterceptorProviders } from "./core/http-interceptors/index";
import { CoreModule } from "./core/core.module";
import { LayoutModule } from './layout/layout.module';
import { RoutesModule } from './routes/routes.module';
import { Angulartics2Module, RouterlessTracking } from 'angulartics2';
@NgModule({
declarations: [
AppComponent
],
imports: [
CoreModule,
BrowserModule,
RoutesModule,
HttpClientModule,
LayoutModule,
Angulartics2Module.forRoot(),
],
providers: [ httpInterceptorProviders, RouterlessTracking],
bootstrap: [AppComponent],
exports: []
})
export class AppModule { }
App Component
import { Component } from '@angular/core';
import {Angulartics2GoogleAnalytics} from "angulartics2/ga";
@Component({
selector: 'ev-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
constructor(angulartics2GoogleAnalytics: Angulartics2GoogleAnalytics) {
angulartics2GoogleAnalytics.startTracking();
}
}
- What is the expected behavior? I would expect a page view in Google Analytics to be recorded as "/email-change-verification/ae22b699-c5cc-46bc-9071-48b1083bc2b7" however it is being recorded as "/"
I believe this is also preventing route changes from being recorded.
What is being recorded...
-
What is the motivation / use case for changing the behavior?
-
Environment:
please run the following and copy the output
./node_modules/.bin/ng --version
I'm having the same issue. Only when I reload the page explicitly for a specific route is it working. This seems to be the most basic functionality but I can't see what I've done wrong.
why are you using RouterlessTracking if you want routes recorded?
My bad, I didn't realize this issue was using RouterlessTracking.
I can open a separate issue. I'm using Angulartics2GoogleGlobalSiteTag but I don't get any PageViews tracked. I can call the API to track an event and that works, but if I try to manually track a PageView, it doesn't report it. If I use gtag
directly, it does work.
@longwa try Angulartics2GoogleTagManager
https://github.com/angulartics/angulartics2/tree/master/src/lib/providers/gtm vs https://github.com/angulartics/angulartics2/tree/master/src/lib/providers/gst
its confusing and i'm not sure if that will fix it.
I didn't realise I had set it up with RouterlessTracking.
Could you point me in the right direction for how to change it?
@craigbroadman https://github.com/angulartics/angulartics2/tree/master#include-it-in-your-application