Skip to content

Analytics not working for prod builds #2295

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

Closed
smarth55 opened this issue Jan 22, 2020 · 3 comments
Closed

Analytics not working for prod builds #2295

smarth55 opened this issue Jan 22, 2020 · 3 comments

Comments

@smarth55
Copy link

Version info

Angular: 9.0.0-rc.9
Firebase: 7.7.0
AngularFire: 5.3.0

How to reproduce these conditions

Following the documentation, add the AngularFireAnalyticsModule to the root module of the application. Run npm run build -- --prod.

Steps to set up and reproduce
I updated by running ng update --all and then ran locally with npm run start. The correct bundles were produced and the analytics console was showing events. I deployed the application for production and checked the analytics console and nothing was being tracked.

Debug output

** Errors in the JavaScript console ** none

** Screenshots **
It looks like the bundles are being created by webpack, but are never requested. I actually did this two different ways. The first was just like the documentation: add the module and it should fire a page_view event, but I noticed that the analytics bundle was never requested from the server:

(it should be 4.*.js)
Screen Shot 2020-01-22 at 10 56 15 AM

I next added {provide: CONFIG, useValue: {send_page_view: false}} and manually called this.analytics.logEvent('page_view'); in my root component and now I see the analytics bundle:
Screen Shot 2020-01-22 at 10 48 33 AM

I'm not sure if this is an ivy issue or not, but when I build for develop, everything works fine without manually logging the event.

Expected behavior

If the documentation is correct, I should see a page_view event after adding the module to my imports.

Actual behavior

No page_view events are being triggered with --prod.

@jamesdaniels
Copy link
Member

Likely an IVY issue, will be cutting AngularFire v6 RC soon with ng 9 support. Keep an eye out for that.

@jimmykane
Copy link

No issues here with 9 + Ivy.

@jamesdaniels
Copy link
Member

Should be addressed in 6.0.0-rc.0, though you might need the work around in #2303 until I drop the next RC. Please reopen if you're still having troubles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants