Skip to content

AngularFireAnalyticsModule not send data #2505

Closed

Description

@Karman40

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!

Activity

  1. WaseemRakab commented on Jun 22, 2020

    @WaseemRakab

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

  2. Karman40 commented on Jun 24, 2020

    @Karman40
    Author

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

  3. WaseemRakab commented on Jun 24, 2020

    @WaseemRakab

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

  4. Karman40 commented on Jun 24, 2020

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

  5. jackcw commented on Jun 26, 2020

    @jackcw
    Contributor

    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.

  6. matthewmullin01 commented on Jun 26, 2020

    @matthewmullin01

    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.

  7. jackcw commented on Jun 26, 2020

    @jackcw
    Contributor

    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

  8. jamesdaniels commented on Jun 26, 2020

    @jamesdaniels
    Contributor

    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.

  9. jackcw commented on Jun 26, 2020

    @jackcw
    Contributor

    @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

  10. Karman40 commented on Jun 28, 2020

    @Karman40
    Author

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

    image

  11. jackcw commented on Jun 28, 2020

    @jackcw
    Contributor

    @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

  12. Karman40 commented on Jul 1, 2020

    @Karman40
    Author

    @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

  13. jimmykane commented on Jul 4, 2020

    @jimmykane

    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

  14. jimmykane commented on Jul 4, 2020

    @jimmykane

    Hey guys is there any workarround for this?

  15. jimmykane commented on Jul 10, 2020

    @jimmykane

    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

  16. 35 remaining items

  17. added a commit that references this issue on Sep 24, 2020
    77a9a15
  18. jamesdaniels commented on Sep 24, 2020

    @jamesdaniels
    Contributor

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

  19. jamesdaniels commented on Sep 24, 2020

    @jamesdaniels
    Contributor

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

  20. conde2 commented on Sep 24, 2020

    @conde2

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

  21. rubenheymans commented on Sep 24, 2020

    @rubenheymans

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

  22. Capelinha commented on Sep 24, 2020

    @Capelinha
    Contributor

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

  23. Splaktar commented on Sep 24, 2020

    @Splaktar
    Contributor

    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?

  24. Splaktar commented on Sep 24, 2020

    @Splaktar
    Contributor

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

  25. jamesdaniels commented on Sep 25, 2020

    @jamesdaniels
    Contributor

    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.

  26. kyleabens commented on Nov 5, 2020

    @kyleabens

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

  27. jackcw commented on Nov 5, 2020

    @jackcw
    Contributor
  28. jamesdaniels commented on Nov 9, 2020

    @jamesdaniels
    Contributor

    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

  29. kyleabens commented on Nov 9, 2020

    @kyleabens

    ScreenTrackingService did the trick, thanks!

  30. arunraj6 commented on Mar 10, 2021

    @arunraj6
    Contributor

    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

  31. mikkimichaelis commented on Sep 17, 2021

    @mikkimichaelis

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions