-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[🐛] Analytics - cannot log custom parameters #4594
Comments
Hi there! I think logScreenView is deprecated and moved, as a side note and you want setCurrentScreen https://firebase.googleblog.com/2020/08/google-analytics-manual-screen-view.html |
Hi Mike! The docs doesn't explicitly allows passing extra params, but it's possible.
Also it's worth mentioning that I'm doing this in another web only Firebase project, and the Analytics reports give me stats about the other params in the single event panel as expected. On the logScreenView/setCurrentScreen issue: it's actually the opposite. This is the issue where it was deprecated, but now it's actually removed: |
Sorry for the delay - I had a chance to think about this a bit more just now
Okay, so this particular area of the code is pretty heavily engineered, so making the change will in the end be a really small change I think, but involve a lot of domain knowledge Analytics uses the "superstruct" dependency to define (and then validate) the object shapes, the 'struct' method that is called during these definitions is exported here:
superstruct apparently supports a way of defining some fixed things (and validating them) while allowing arbitrary other things: https://docs.superstructjs.org/resources/faq#how-can-i-allow-unknown-keys-with-object-structs If you can bend the definitions of Alternatively (and maybe actually easier though it is more typing - literally typing keys, but also typescript typing) expand the parameters to include the upstream list: https://github.com/firebase/firebase-js-sdk/blob/3d5354021abaedcc108e0c960026990f5c5eda26/packages/analytics-types/index.d.ts#L125-L153 That second style might be better as it is strongly typed, although the first style is potentially less fragile as we wouldn't have to stay in sync with firebase-js-sdk - tradeoffs in both directions. I think I might prefer strong typing really, as that's the point of typescript, even if it makes things a bit more fragile as we'll be dependent on their definitions. |
Hello 👋, to help manage issues we automatically close stale issues.
|
Hi, is there any update on this? Would love to be able to start tracking custom metrics and AFAICT there is not a clear way to achieve this. |
All the dev in this repo is out in the open and you're the first comment in a while, so you are the update. Do you have a PR in mind? Happy to collaborate to help get it merged |
…5811) * fix(analytics): allow custom event parameters for screen_view events Fixes #4594. * style(lint): fix prettier error Co-authored-by: Mike Hardy <[email protected]>
@tomonacci generously looked into this and provided a PR to fix it! Will be out in the next release (usually near the end of the week, every week) 🚀 |
🔥
Issue
Other Firebase platforms let me log custom dimensions and metrics alongside standard events, like a
section
inside of ascreen_view
event, but RNFirebase does not.When trying to call
logScreenView
with custom parameters, the library gives anfirebase.analytics().logScreenView()*: unknown property 'X'.
error.Project Files
Doesn't require special setup other than adding Analytics package.
Javascript
Click To Expand
package.json
:# N/A
firebase.json
for react-native-firebase v6:# N/A
iOS
Click To Expand
ios/Podfile
:# N/A
AppDelegate.m
:// N/A
Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:// N/A
android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:10.0.0
Firebase
module(s) you're using that has the issue:@react-native-firebase/analytics: 10.0.0
TypeScript
?Y
&4.1.2
React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: