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 {
7272 return ;
7373 }
7474
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+ }
7881 } ) ;
7982
8083 const activeSpan = getActiveSpan ( ) ;
Original file line number Diff line number Diff line change @@ -72,9 +72,12 @@ export function trackLcpAsStandaloneSpan(): void {
7272 return ;
7373 }
7474
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+ }
7881 } ) ;
7982
8083 const activeSpan = getActiveSpan ( ) ;
You can’t perform that action at this time.
0 commit comments