File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
packages/browser-utils/src/metrics Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,12 @@ export function trackClsAsStandaloneSpan(): void {
72
72
return ;
73
73
}
74
74
75
- const unsubscribeStartNavigation = client . on ( 'startNavigationSpan' , ( ) => {
76
- _collectClsOnce ( ) ;
77
- unsubscribeStartNavigation ?.( ) ;
75
+ const unsubscribeStartNavigation = client . on ( 'startNavigationSpan' , ( _ , options ) => {
76
+ // we only want to collect LCP if we actually navigate. Redirects should be ignored.
77
+ if ( ! options ?. isRedirect ) {
78
+ _collectClsOnce ( ) ;
79
+ unsubscribeStartNavigation ?.( ) ;
80
+ }
78
81
} ) ;
79
82
80
83
const activeSpan = getActiveSpan ( ) ;
Original file line number Diff line number Diff line change @@ -72,9 +72,12 @@ export function trackLcpAsStandaloneSpan(): void {
72
72
return ;
73
73
}
74
74
75
- const unsubscribeStartNavigation = client . on ( 'startNavigationSpan' , ( ) => {
76
- _collectLcpOnce ( ) ;
77
- unsubscribeStartNavigation ?.( ) ;
75
+ const unsubscribeStartNavigation = client . on ( 'startNavigationSpan' , ( _ , options ) => {
76
+ // we only want to collect LCP if we actually navigate. Redirects should be ignored.
77
+ if ( ! options ?. isRedirect ) {
78
+ _collectLcpOnce ( ) ;
79
+ unsubscribeStartNavigation ?.( ) ;
80
+ }
78
81
} ) ;
79
82
80
83
const activeSpan = getActiveSpan ( ) ;
You can’t perform that action at this time.
0 commit comments