Skip to content
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

AngularFireAnalyticsModule not send data #2505

Closed
Karman40 opened this issue Jun 15, 2020 · 63 comments · Fixed by #2594
Closed

AngularFireAnalyticsModule not send data #2505

Karman40 opened this issue Jun 15, 2020 · 63 comments · Fixed by #2594

Comments

@Karman40
Copy link

Karman40 commented Jun 15, 2020

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!

@WaseemRakab
Copy link

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

@Karman40
Copy link
Author

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

@WaseemRakab
Copy link

WaseemRakab commented Jun 24, 2020

@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
Copy link
Author

@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.

@jackcw
Copy link
Contributor

jackcw commented Jun 26, 2020

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.

@matthewmullin01
Copy link

matthewmullin01 commented Jun 26, 2020

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.

@jackcw
Copy link
Contributor

jackcw commented Jun 26, 2020

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

@jamesdaniels
Copy link
Member

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.

@jackcw
Copy link
Contributor

jackcw commented Jun 26, 2020

@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

@Karman40
Copy link
Author

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

image

@jackcw
Copy link
Contributor

jackcw commented Jun 28, 2020

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

@Karman40
Copy link
Author

Karman40 commented Jul 1, 2020

@Karman40 you will see a console log entry that says Sending request: {URL} if it actually sends it. drop back to @angular/fire@6.0.0 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

@jimmykane
Copy link

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

@jimmykane
Copy link

Hey guys is there any workarround for this?

@jimmykane
Copy link

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

@rubenheymans
Copy link

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

@ghost
Copy link

ghost commented Jul 23, 2020

Same on my end.

@pablomargareto
Copy link

Same here

1 similar comment
@akshay-js
Copy link

Same here

@WaseemRakab
Copy link

Same here, using angular 10 with ionic 5

@jimmykane
Copy link

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

@razfriman
Copy link

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

@jimmykane
Copy link

@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.

@conde2
Copy link

conde2 commented Jul 26, 2020

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

@google-admin put more people in this project!

@vamsiambati
Copy link

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

@jimmykane
Copy link

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

@conde2
Copy link

conde2 commented Jul 28, 2020

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

@rubenheymans
Copy link

@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

@mparpaillon
Copy link

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?

@MrGWest
Copy link

MrGWest commented Sep 10, 2020

So this is it? I use SSR and NG10 with @angular/fire@6.0.0 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?

@gabrielnvian
Copy link

Having the same issue. Any news?

@canguruhh
Copy link

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

@ghost
Copy link

ghost commented Sep 12, 2020

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

@adamlaz
Copy link

adamlaz commented Sep 15, 2020

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 😬

@MrGWest
Copy link

MrGWest commented Sep 15, 2020

Today it's working.

Using Angular 10.0.11 with server-side rendering and @angular/fire@6.0.0. 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. 🤷‍♂️

@Splaktar
Copy link
Member

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).

@abchugh
Copy link

abchugh commented Sep 18, 2020

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?

@jamesdaniels
Copy link
Member

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.

@abchugh
Copy link

abchugh commented Sep 18, 2020

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.

jamesdaniels pushed a commit that referenced this issue Sep 24, 2020
Change arrow function to a normal function to use the arguments object as described in the gtag documentation. That way, analytics sends data back to Google again.

Fixes #2505
@jamesdaniels
Copy link
Member

@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.

@jamesdaniels
Copy link
Member

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 🤦‍♂️

@conde2
Copy link

conde2 commented Sep 24, 2020

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

@rubenheymans
Copy link

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

@Capelinha
Copy link
Contributor

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

@Splaktar
Copy link
Member

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?

@Splaktar
Copy link
Member

It looks like we can track the Performance issues in #2502.

@jamesdaniels
Copy link
Member

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.

@kyleabens
Copy link

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

@jackcw
Copy link
Contributor

jackcw commented Nov 5, 2020 via email

@jamesdaniels
Copy link
Member

jamesdaniels commented Nov 9, 2020

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

@kyleabens
Copy link

ScreenTrackingService did the trick, thanks!

@arunraj6
Copy link
Contributor

arunraj6 commented Mar 10, 2021

I was also facing the same issue. Following version combinations worked for me later.

Anglular - 8.2.4
angular/fire - 5.4.2
firebase - 7.20.0

or

Anglular - 10.0.3
angular/fire - 6.0.4
firebase - 8.2.10

Try to keep the versions as mention in this documentation.
https://www.npmjs.com/package/@angular/fire

@mikkimichaelis
Copy link

mikkimichaelis commented Sep 17, 2021

I simply cannot figure this one out. @angular/fire works great except for device analytics. Fine for SPA. Device logs the DEBUG events but nothing shows up in firebase or Analytics console. Firebase debug view shows no devices. Analytics Console setup process ends with checking for device connectivity but never works.

Following the instructions for device build I pass appId, for SPA I pass measurementId and appId. So SPA works and Device not, so logically I tried adding in the measurementId to the device config. No work. Read everything on the web about @angular/fire/analytics and find no direct reference to passing measurementId to a device.

What about these google-services.json files that are generated? Again, no reference to them in the @angular/fire docs. I did add these config files properly to my Cordova config (and work just fine for the reasons I added them) but analytics does not work.

I've tried aligning my module versions according to https://www.npmjs.com/package/@angular/fire with no success. downgraded to the above mentioned working modules with no success.

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

Successfully merging a pull request may close this issue.