-
Notifications
You must be signed in to change notification settings - Fork 1
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
Firebase Analytics + Sentry error logging #54
Conversation
I keep getting
(this is testing on iPad btw) nothing seems wrong, but I also installed packages yarn complained about just in case. Anyway unable to test it because of that 😅 |
I'm getting a new error logging into A&S with
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks so clean and overall pretty good 😍Left a nit on naming, and some additional ones below:
- Logging: All my actions are logging onto Firebase fine! I have one thing about logs that I couldn't quite figure out/wrap my head around – why are some of the events within
screen_view
while others are not? See pic below.
- Additional Events: Noticed that most of the events logged are successful ones – think there might be some value in capturing events that are failure cases? That's unless there are plans to log with Sentry. Left an example above, but others I can think of:
- When customer is not found
- Clerk fail to log in?
- Redundant events: Unless there are specific functions for logging certain actions, thought that there are a lot of things being logged right now - maybe consider removing some that are less helpful? Mostly concerned that it might slow down the app.
screens/modals/QuantityModal.js
Outdated
Analytics.logEvent('ConfirmQuantity', { | ||
name: 'Apply product quantity', | ||
function: 'handleUpdateCart', | ||
screen: 'QuantityModal', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be confusing to have screen
as an event property since screen_name
is captured with the Analytics too. Perhaps component
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Thanks Tommy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I added Sentry logging to all the catch blocks we currently have since one already got added. Remember to add documentation for Firebase ! Because we have two projects and both have to be shared to the HC team if they aren't yet; wondering if we should share all the accounts to their team email or make one for them (since I have two sites deployed also under my accounts)
screens/StoreLookupScreen.js
Outdated
@@ -69,6 +70,11 @@ export default class StoreLookupScreen extends React.Component { | |||
handleNavigate = async () => { | |||
// Clerk training: set `trainingMode` to "true" in AsyncStorage | |||
if (this.state.store.storeName === 'CLERK TRAINING') { | |||
await Analytics.logEvent('SelectTrainingMode', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Analytics.logEvent
returns a promise? Googled a bit and it doesn't seem like it. If it does, we'll have to add try/catch blocks because that means there are unhandled promise rejections. Otherwise, using await
here is a bit misleading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you're right. I removed the await
s
screens/CustomerLookupScreen.js
Outdated
@@ -41,6 +42,13 @@ export default class CustomerLookupScreen extends React.Component { | |||
|
|||
_asyncCustomerFound = async (customerRecord) => { | |||
await AsyncStorage.setItem('customerId', customerRecord.id); | |||
await Analytics.logEvent('CustomerFound', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await
used here
component: 'ClerkLoginScreen', | ||
clerk_id: clerkRecord.id, | ||
clerk_name: clerkRecord.clerkName, | ||
store_name: clerkRecord.storeName[0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity why did this fix it? Do lookup
type records always return arrays from Airtable :o I was not aware
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah apparently they do return arrays. Not sure if there's a better way to do this, since clerks should only ever be connected to a single store?
…chen-clerks into AnnieW/firebase
What's new in this PR
Relevant Links
Online sources
Firebase setup
Expo Firebase Analytics
Related PRs
Analogous to calblueprint/dccentralkitchen#88
How to review
InApp.js
setAnalytics.setAnalyticsCollectionEnabled(false)
totrue
.StreamView
underAnalytics
in the menu on the leftundefined
.Next steps
logUtils
like Sentry. This might be difficult to standardize since the parameters attached to each event vary so much, butTests Performed, Edge Cases
Screenshots
CC: @anniero98