Angularfire: AngularFireAnalyticsModule not send data

Created on 16 Jun 2020  ·  61Comments  ·  Source: angular/angularfire

Version info

Angular: 9.1.11
Firebase: 7.15.1
AngularFire: 5.4.2

Other (e.g. Ionic/Cordova, Node, browser, operating system): Web

How to reproduce these conditions

My config:

import {AngularFireAnalyticsModule, DEBUG_MODE, ScreenTrackingService, UserTrackingService} from '@angular/fire/analytics';

AngularFireAnalyticsModule

  providers: [
    ScreenTrackingService,
    UserTrackingService,
    {provide: DEBUG_MODE, useValue: true},
    {provide: REGION, useValue: 'europe-west1'}
  ]

I have measurementId in config.

But not send any data :/. i init more than 1 month.

image

Thnaks!

Most helpful comment

Unfortunately for those encountering this bug; I've been very focused on preparations for the summit, new product launches, other libraries, and helping some key partners with solutions as of late.

While I've not had the cycles to dig into this yet, this issue will be my top priority when I'm able to carve out some engineering time from the rest of my responsibilities. I'm hoping to find the chance to settle back into coding in the next week or so & have been putting feelers out for others who could help with the maintenance burden.

In the meantime, I welcome any assistance from the community here.

All 61 comments

Same issue here, using the same packages as the original poster.
Help!?

@WaseemRakab i think this is Firebase error and not a library error.

@Karman40 i think this is Firebase error and not a library error.

Im not sure though, it could be, maybe the analytics data doesn’t show up instantly? Takes some time?

@Karman40 i think this is Firebase error and not a library error.

Im not sure though, it could be, maybe the analytics data doesn’t show up instantly? Takes some time?

In principle, nothing appears for the first 24 hours, but then real-time. Although I haven't seen anything in 1 month.

Replicated this as well, all using the latest libraries.

If you install the Google Analytics Debugger Chrome Extension you can see the events getting logged but they arent then being sent to Analytics.

I then removed angular fire analytics and put the tags in manually to the index.html file and it starts logging events

<!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/7.15.4/firebase-app.js"></script>

<!-- If you enabled Analytics in your project, add the Firebase SDK for Analytics -->
<script src="https://www.gstatic.com/firebasejs/7.15.4/firebase-analytics.js"></script>

<script>
    var firebaseConfig = {}

    firebase.initializeApp(firebaseConfig);
    firebase.analytics();
</script>

However its now not hooked upto the angular router so each path change doesn't do anything.

Leaving this content in the index.html file, i then imported AngularFireAnalyticsModule back into the app.module file as well as providing { provide: DEBUG_MODE, useValue: true }, ScreenTrackingService, UserTrackingService and then i found it was logging events again however it didnt seem to log all but this could be a debug issue, as in the console it showed it sending each event. Doing this however did cause a couple errors in the console with a warning about Warning: Firebase is already defined in the global scope. Please make sure Firebase library is only loaded once. and a setting the time issue it looks

One thing i also noticed is that it set a blank user_id property even though a user wasnt logged in.

I don't think I could have phrased it any better that @jackcw has. I've been experiencing pretty much exactly the same thing over the past few weeks.

Without explicitly initialising analytics with the vanilla firebase package using firebase.analytics(); I too would not get any events logged (Or at best one in every 10 events would log - even when using the Analytics Debugger and Firebase Debug View). My path changes are also not being logged either with or without the ScreenTrackingService provided.

What is even stranger is events do seem to be logged sometimes without an obvious pattern, making the exact cause of the issue quite tough to pin down.

I'd be happy to provide any more info that may be of value.

i've had some success downgrading to @angular/[email protected]. If i get some time i'll try diff the difference try work out what the change was but quite busy at the moment

I believe this might be due to some overly aggressive tree-shaking happening, knocking out Firebase JS SDKs side-effects. Can you try the latest canary? 6.0.3-canary.7cb6c03 I've noticed this getting progressively worse with newer versions of ngcc... I'm experimenting with work arounds now.

@jamesdaniels just tried the canary but its not working sorry. The Google Analytics Debugger Chrome Extension doesnt show the sending request url in the console, flipped back to 6.0.0 and it shows the sending request url

The Google Analytics Debugger Chrome Extension does show data, but direbase console dosent show.

image

@Karman40 you will see a console log entry that says Sending request: {URL} if it actually sends it. drop back to @angular/[email protected] and you should see it works whilst a fix is worked out

@Karman40 you will see a console log entry that says Sending request: {URL} if it actually sends it. drop back to @angular/[email protected] and you should see it works whilst a fix is worked out

@jackcw i use 5.4.2 because in v6 auth works pretty badly

Hi I am facing this issue as well.

At least I am happy that it was not just a big user drop for some reason.

There is no analytics call happening at all with the latest 6.0.2 and latest Angular 10

Hey guys is there any workarround for this?

Hey @jamesdaniels could we expect a fix ? I understand that you are alone in this and if we can do anything to help it would be great letting us know

Both analytics and performance monitoring (and ssr too) are not working on the latest version.
@google-admin can you please put more guys on this project and make it mature, angular and firebase are both Google products! no blame on @jamesdaniels he is doing a great job but man he needs help

Same on my end.

Same here

Same here

Same here, using angular 10 with ionic 5

I opened a support ticket. I am sorry guys.

This might not be related and this analytics issue perhaps it's not so important but this is.

I did mention both issues.

I admire the work of @jamesdaniels and the spirit of him here maintaining this repo but he needs a backup :-D

By all means this is not about @jamesdaniels doing something wrong here, but rather just wanting to help him, get someone helping here :-D

@jimmykane i don’t understand why cookies would affect the analytics of angular fire not triggering

@razfriman no that's unrealted to this ticket. It's another ticket for the Js sdk and auth.

I just opened a ticket with both issues.

Facing same problem here, no data shows in DebugView or StreamView !!

@google-admin put more people in this project!

same issue, noting is getting captured both analytics and performance!

Support answered that this project is considered a 3rd party for them :-/

@jimmykane where did you open the ticket? Maybe more people opening tickets they put more attetion in here.

@conde2 I also got the same reaction, it's just a 3rd party repo, doesn't make any sense.
Here is the link: https://firebase.google.com/support/troubleshooter/contact?authuser=0

Me too..
any solution here,,, i need control my deactive google analytics

For me going to v6.0.0 worked

On Wed, 5 Aug 2020, 05:52 rickymerby, notifications@github.com wrote:

Me too..
any solution here,,, i need control my deactive google analytics


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/angular/angularfire/issues/2505#issuecomment-668964283,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAJVX47CDFNVNDHY5ZW2SU3R7DJPFANCNFSM4N65G6RQ
.

Wow, I just realized that I lost 1.5 months worth of Analytics and Performance data due to this issue and my updating the library to 6.0.2! Ouch! 🤦

Thankfully I still have some data from LogRocket, but this seems like it should be a P1 critical issue that needs a hotfix/patch ASAP.

There should also be some consideration for deprecating the 6.0.2 version on NPM as well.

I reverted to 6.0.0 and data immediately starting sending from my app and showing up in StreamView.

@jamesdaniels Is there a status update about this issue? Since rolling back to v6.0.0 will not work for my project since we are already on the canary build by this bug.

He had a couple of comments on Twitter but it's not clear what the fix should be. Hopefully he'll have some time next week to investigate now that the priority is raised a little 🤞

I'm experiencing this problem also. Lost a weeks data after 6.0.2 upgrade about a month ago but downgraded to 6.0.0 to get data again. Using Angular 10.

some updates?

@jamesdaniels Two months since this issue was reported, is there already an update available?

Any news? It seems to work in version 6.0.0, but not with SSR

any news?

I just read the changelog and I don't understand how such a minor update could break the Analytics. But I rolled back to 6.0.0 and it's working fine now... What am I missing?

So this is it? I use SSR and NG10 with @angular/[email protected] and most of the events, while they show in dev tools' console, they do not reach Firebase's analytics Debug View. My only option is the setup the vanilla JS firebase SDK?

Having the same issue. Any news?

Same here. Downgrading to v6.0.0 did not help. Debug mode shows the events but it doesnt send them. Using Angular 10 with ionic 5

Maybe this issue could get pinned so it gets a little more attention?

For any newcomers to this thread. AngularFireAnalytics is broken and does not send any data to Google.

Some have suggested manually calling firebase.analytics(); or downgrading @angular/fire to 6.0.0.. I haven't gotten either of those solutions to work on any of my apps. 😞

If you install the Google Analytics Debugger, you will see the events, page views, and user-data being captured... but they don't make it to Google Analytics or Firebase for a reason that is unknown to me.

I'm going to continue to try and get this to work, but hopefully we can all use this issue to centralize all debugging info, plus proposed solutions to try and help w/ getting this resolved for all!

I'm sure @jamesdaniels would appreciate some help here 😬

Today it's working.

Using Angular 10.0.11 with server-side rendering and @angular/[email protected]. Our project exists of 1 shared module and 4 lazy loaded modules. When I reported my issue 5 days ago I was testing events using the Debug View and none of the events in the lazy loaded modules, even though they showed in the dev tools console, did not arrive in Firebase's Debug View.

I would say clear your cache, but if that was the issue then I would not have seen the events printed in dev tools console. 🤷‍♂️

I just checked my data in Firebase. I can confirm that I'm still getting Analytics data, for some weeks now, after reverting to 6.0.0, but it doesn't seem like any of my Performance data is coming through (for a couple months now).

It's been 3 months since this severe bug was opened. Although @jamesdaniels has been helpful to this community, it doesn't look like there aren't any developers left who work/provide-support to this project.
@jamesdaniels Should we consider that this project has been deprecated? Can you suggest an alternative offering/documentation for Google analytics in angular?

Unfortunately for those encountering this bug; I've been very focused on preparations for the summit, new product launches, other libraries, and helping some key partners with solutions as of late.

While I've not had the cycles to dig into this yet, this issue will be my top priority when I'm able to carve out some engineering time from the rest of my responsibilities. I'm hoping to find the chance to settle back into coding in the next week or so & have been putting feelers out for others who could help with the maintenance burden.

In the meantime, I welcome any assistance from the community here.

Thanks, @jamesdaniels - you seem to be a lone warrior trying to keep this project up and running. AngularFire is a very useful library. I wish it was treated as a core(-ish) component of Angular and the major releases were aligned and tested rigorously. I guess along with technical issues you are also facing organizational challenges.
I'd like to contribute but I am neither proficient at frontend technologies nor do I have time to spare.

@Capelinha found it! The fix has been cut on NPM @canary give it a shot all, let me know how it goes and I'll cut 6.0.3 ASAP.

It turns out gtag uses arguments, you can't pass destructured args. When we added linting requirements to the codebase after 6.0 it had us refactor to an arrow function... one of the gotchas with arrow functions 🤦‍♂️

Thanks @jamesdaniels and @Capelinha for keeping this project alive !

great! does this mean performance monitoring will work again too?

@rubenheymans I'm not sure, in the company I work for we use only analytics. You can test and tell us the result.

I can confirm that this fix is working locally and in production (https://www.devintent.com/).

great! does this mean performance monitoring will work again too?

Unfortunately, it doesn't appear that this solves the issue with performance. Do we have that tracked in a separate issue?

It looks like we can track the Performance issues in https://github.com/angular/angularfire/issues/2502.

I've cut the fix in 6.0.3, if our CI/CD server is kind it should be on NPM in a few minutes.

I believe with v6.0.4 this is no longer working again. Can anyone else confirm this?

I would recommend checking you have provided the service for screen
tracking. Previously it would accidentally provide itself and now it's only
done if you provide it directly

On Thu, 5 Nov 2020, 17:43 Kyle Abens, notifications@github.com wrote:

I believe with v6.0.4 this is no longer working again. Can anyone else
confirm this?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/angular/angularfire/issues/2505#issuecomment-722532184,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAXXZYSAPG6Z7TV72URHCL3SOLP5FANCNFSM4N65G6RQ
.

Yes, please ensure that you've added the ScreenTrackingService in 6.0.3 this wasn't properly tree-shaking out if you didn't provide it; meaning analytics was opt-out rather than an opt-in as documented. Fixed this in 6.0.4

ScreenTrackingService did the trick, thanks!

Was this page helpful?
0 / 5 - 0 ratings