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

analytics: add tracking for screen dimensions + fix nav events on android #4088

Merged
merged 5 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/hooks/useDimensions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ScaledSize, useWindowDimensions } from 'react-native';
import { analytics } from '@/analytics';

const deviceDimensions = {
iphone6: {
Expand Down Expand Up @@ -30,6 +31,7 @@ export interface DeviceDimensions extends ScaledSize {

export default function useDimensions(): DeviceDimensions {
const { height, width, ...restOfDimensions } = useWindowDimensions();
analytics.identify(undefined, { screenWidth: width, screenHeight: height });
skylarbarrera marked this conversation as resolved.
Show resolved Hide resolved
return {
height,
isLargePhone: width >= deviceDimensions.iphoneX.width,
Expand Down
4 changes: 1 addition & 3 deletions src/navigation/onNavigationStateChange.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ export function onNavigationStateChange(currentState) {
}

sentryUtils.addNavBreadcrumb(prevRouteName, routeName, paramsToTrack);
return android
? paramsToTrack && analytics.screen(routeName, paramsToTrack)
: analytics.screen(routeName, paramsToTrack);
return analytics.screen(routeName, paramsToTrack);
}
}