-
Notifications
You must be signed in to change notification settings - Fork 2.2k
ScreenTrackingService and UserTrackingService not triggering events in Angular 19 #3633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This issue does not seem to follow the issue template. Make sure you provide all the required information. |
For me, it's worse. I can't see the device in the Firebase console (DebugView) for debugging. I thought I'd add a console.log. {
providers: [
provideFirebaseApp(() => initializeApp(environment.firebase)),
provideAnalytics(() => {
const analytics = getAnalytics();
console.log("ANALYTICS!!!!", analytics)
return analytics;
}),
ScreenTrackingService,
UserTrackingService,
]
} The log doesn't appear. It turns out that even the provideAnalytics callback function isn't executed, which is why I can't even debug. ng version
|
@dzylich be aware of this |
Thanks @dzylich for opening the issue. While the docs mention that one should simply inject the A workaround is to import the providers from angularfire/src/analytics/analytics.module.ts Lines 60 to 65 in ec4e3bd
IMHO, ideally, export function provideScreenTracking(): EnvironmentProviders {
return makeEnvironmentProviders([
ScreenTrackingService,
provideAppInitializer(() => inject(ScreenTrackingService).init()) // `ScreenTrackingService#init` is just an example of the initialization logic
]);
} Hope this helps, happy tracking! 👀 |
Overview of the Issue
Using Angular 19 and AngularFire 19, the ScreenTrackingService and UserTrackingService do not trigger events.
Angular Version
Here is a section of my package.json:
Motivation for or Use Case
These services are supposed to automatically log router and firebase authentication events. When I use the logEvent function from the analytics package, events are logged, but I do not see any events logged from ScreenTrackingService and UserTrackingService
Browsers and Operating System
I am using Chrome Version 133.0.6943.142 (Official Build) (64-bit) on Windows 10
Reproduce the Error
On the DebugView in the Firebase Console, I can see the page_view event for the initial page load.
When I click links to routes around my app, or when I login and logout, I do not see any events.
Here is a component where I am manually triggering an event, and I can see the event in the DebugView:
Here is my app.routes.ts file:
Here is the sample.module file:
Here is the SampleRoutingModule:
On the HomeComponent, I link to the various pages in the SampleModule like this:
Here is my app.config.ts file:
I also tried these configs in the app config and the result was the same:
Suggest a Fix
When I run the Google Analytics Debugger, I can see events logging in the console from the logEvent function call in the HomeComponent. When I click various router links, I do not see any logs in the console. When I log in and out (using firebase auth signInWithPopup), I don't see any logs.
I added some debugger breakpoints in the ScreenTrackingService and UserTrackingService. The breakpoints at the top of the file are hit, so the file is loading. But the breakpoints in the constructors and ɵscreenViewEvent function are not hit at all.
It seems like the ScreenTrackingService and UserTrackingService are not getting constructed, called, or instantiated.
The text was updated successfully, but these errors were encountered: