-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* import more types from web-vitals * add navigation type to event * Add FCP metric to web vitals tracking * reordered conditional * add new params to fcp * import more types from web-vitals * add navigation type to event * Add FCP metric to web vitals tracking * reordered conditional * add new params to fcp
- Loading branch information
1 parent
6198ef5
commit 9f7884b
Showing
4 changed files
with
110 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
import { onCLS, onINP, onLCP } from './web-vitals.js'; | ||
import { onCLS, onINP, onFCP, onLCP } from './web-vitals.js'; | ||
import { sendToAnalytics } from './send-to-analytics.js'; | ||
|
||
if (typeof window !== 'undefined' && 'gas4' in window) { | ||
performance.mark('dap-loaded'); | ||
const initWebVitalsEvents = () => { | ||
onCLS(sendToAnalytics); | ||
onFCP(sendToAnalytics); | ||
onINP(sendToAnalytics); | ||
onLCP(sendToAnalytics); | ||
}; | ||
|
||
if (typeof window !== 'undefined' && 'gas4' in window) { | ||
initWebVitalsEvents(); | ||
} else { | ||
window.addEventListener('dap-universal-federated-analytics-load', () => { | ||
performance.mark('dap-loaded'); | ||
onCLS(sendToAnalytics); | ||
onINP(sendToAnalytics); | ||
onLCP(sendToAnalytics); | ||
initWebVitalsEvents(); | ||
}); | ||
} | ||
|
||
performance.mark('dap-performance-addon-loaded'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters