@@ -24,7 +24,7 @@ function perfumeJsPlugin(pluginConfig = {}) {
24
24
name : 'perfume.js' ,
25
25
config : conf ,
26
26
initialize : ( { instance, config } ) => {
27
- const { perfume, destinations } = config
27
+ const { perfume, destinations, metricNames = metrics } = config
28
28
const perfumeOptions = config . perfumeOptions || { }
29
29
const PerfumeInstance = ( typeof Perfume !== 'undefined' ) ? Perfume : perfume
30
30
// Don't initialize if perfume.js not included
@@ -33,19 +33,6 @@ function perfumeJsPlugin(pluginConfig = {}) {
33
33
return false
34
34
}
35
35
36
- /* See https://github.com/Zizzamia/perfume.js#performance-audits */
37
- const metricNames = [
38
- 'fp' , // firstPaint
39
- 'fcp' , // firstContentfulPaint
40
- 'lcp' , // largestContentfulPaint
41
- 'lcpFinal' , // largestContentfulPaintFinal
42
- 'fid' , // firstInputDelay
43
- 'cls' , // cumulativeLayoutShift
44
- 'clsFinal' , // cumulativeLayoutShiftFinal
45
- 'tbt' , // totalBlockingTime
46
- 'tbt10S' , // totalBlockingTime10S
47
- 'tbtFinal' // totalBlockingTimeFinal
48
- ]
49
36
/* Where data should send */
50
37
const dataSinks = ( ! destinations ) ? { all : true } : destinations
51
38
/* Initialize perfume.js tracker */
@@ -74,4 +61,18 @@ function perfumeJsPlugin(pluginConfig = {}) {
74
61
}
75
62
}
76
63
64
+ /* See https://github.com/Zizzamia/perfume.js#performance-audits */
65
+ export const metrics = [
66
+ 'fp' , // firstPaint
67
+ 'fcp' , // firstContentfulPaint
68
+ 'lcp' , // largestContentfulPaint
69
+ 'lcpFinal' , // largestContentfulPaintFinal
70
+ 'fid' , // firstInputDelay
71
+ 'cls' , // cumulativeLayoutShift
72
+ 'clsFinal' , // cumulativeLayoutShiftFinal
73
+ 'tbt' , // totalBlockingTime
74
+ 'tbt10S' , // totalBlockingTime10S
75
+ 'tbtFinal' // totalBlockingTimeFinal
76
+ ] ;
77
+
77
78
export default perfumeJsPlugin
0 commit comments