Skip to content

Commit 1e335d7

Browse files
authored
Merge pull request #216 from akre54/patch-3
Export metricNames for overriding
2 parents 95605d8 + 03af317 commit 1e335d7

File tree

1 file changed

+15
-14
lines changed
  • packages/analytics-plugin-perfumejs/src

1 file changed

+15
-14
lines changed

packages/analytics-plugin-perfumejs/src/index.js

+15-14
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function perfumeJsPlugin(pluginConfig = {}) {
2424
name: 'perfume.js',
2525
config: conf,
2626
initialize: ({ instance, config }) => {
27-
const { perfume, destinations } = config
27+
const { perfume, destinations, metricNames = metrics } = config
2828
const perfumeOptions = config.perfumeOptions || {}
2929
const PerfumeInstance = (typeof Perfume !== 'undefined') ? Perfume : perfume
3030
// Don't initialize if perfume.js not included
@@ -33,19 +33,6 @@ function perfumeJsPlugin(pluginConfig = {}) {
3333
return false
3434
}
3535

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-
]
4936
/* Where data should send */
5037
const dataSinks = (!destinations) ? { all: true } : destinations
5138
/* Initialize perfume.js tracker */
@@ -74,4 +61,18 @@ function perfumeJsPlugin(pluginConfig = {}) {
7461
}
7562
}
7663

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+
7778
export default perfumeJsPlugin

0 commit comments

Comments
 (0)