Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
ETH Web Vitals
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WP Plugins
ETH Web Vitals
Commits
b874eea8
Commit
b874eea8
authored
5 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
Fix Piwik event recording
parent
600a2677
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
assets/build/web-vitals.js
+1
-1
1 addition, 1 deletion
assets/build/web-vitals.js
assets/src/web-vitals.js
+9
-1
9 additions, 1 deletion
assets/src/web-vitals.js
with
10 additions
and
2 deletions
assets/build/web-vitals.js
+
1
−
1
View file @
b874eea8
!
function
(
e
){
var
t
=
{};
function
n
(
i
){
if
(
t
[
i
])
return
t
[
i
].
exports
;
var
a
=
t
[
i
]
=
{
i
:
i
,
l
:
!
1
,
exports
:{}};
return
e
[
i
].
call
(
a
.
exports
,
a
,
a
.
exports
,
n
),
a
.
l
=!
0
,
a
.
exports
}
n
.
m
=
e
,
n
.
c
=
t
,
n
.
d
=
function
(
e
,
t
,
i
){
n
.
o
(
e
,
t
)
||
Object
.
defineProperty
(
e
,
t
,{
enumerable
:
!
0
,
get
:
i
})},
n
.
r
=
function
(
e
){
"
undefined
"
!=
typeof
Symbol
&&
Symbol
.
toStringTag
&&
Object
.
defineProperty
(
e
,
Symbol
.
toStringTag
,{
value
:
"
Module
"
}),
Object
.
defineProperty
(
e
,
"
__esModule
"
,{
value
:
!
0
})},
n
.
t
=
function
(
e
,
t
){
if
(
1
&
t
&&
(
e
=
n
(
e
)),
8
&
t
)
return
e
;
if
(
4
&
t
&&
"
object
"
==
typeof
e
&&
e
&&
e
.
__esModule
)
return
e
;
var
i
=
Object
.
create
(
null
);
if
(
n
.
r
(
i
),
Object
.
defineProperty
(
i
,
"
default
"
,{
enumerable
:
!
0
,
value
:
e
}),
2
&
t
&&
"
string
"
!=
typeof
e
)
for
(
var
a
in
e
)
n
.
d
(
i
,
a
,
function
(
t
){
return
e
[
t
]}.
bind
(
null
,
a
));
return
i
},
n
.
n
=
function
(
e
){
var
t
=
e
&&
e
.
__esModule
?
function
(){
return
e
.
default
}:
function
(){
return
e
};
return
n
.
d
(
t
,
"
a
"
,
t
),
t
},
n
.
o
=
function
(
e
,
t
){
return
Object
.
prototype
.
hasOwnProperty
.
call
(
e
,
t
)},
n
.
p
=
""
,
n
(
n
.
s
=
0
)}([
function
(
e
,
t
,
n
){
"
use strict
"
;
n
.
r
(
t
);
var
i
,
a
,
r
=
function
(){
return
""
.
concat
(
Date
.
now
(),
"
-
"
).
concat
(
Math
.
floor
(
8999999999999
*
Math
.
random
())
+
1
e12
)},
o
=
function
(
e
){
var
t
=
arguments
.
length
>
1
&&
void
0
!==
arguments
[
1
]?
arguments
[
1
]:
-
1
;
return
{
name
:
e
,
value
:
t
,
delta
:
0
,
entries
:[],
id
:
r
(),
isFinal
:
!
1
}},
u
=
function
(
e
,
t
){
try
{
if
(
PerformanceObserver
.
supportedEntryTypes
.
includes
(
e
)){
var
n
=
new
PerformanceObserver
((
function
(
e
){
return
e
.
getEntries
().
map
(
t
)}));
return
n
.
observe
({
type
:
e
,
buffered
:
!
0
}),
n
}}
catch
(
e
){}},
c
=!
1
,
s
=!
1
,
l
=
function
(
e
){
c
=!
e
.
persisted
},
d
=
function
(){
addEventListener
(
"
pagehide
"
,
l
),
addEventListener
(
"
unload
"
,(
function
(){}))},
f
=
function
(
e
){
var
t
=
arguments
.
length
>
1
&&
void
0
!==
arguments
[
1
]
&&
arguments
[
1
];
s
||
(
d
(),
s
=!
0
),
addEventListener
(
"
visibilitychange
"
,(
function
(
t
){
var
n
=
t
.
timeStamp
;
"
hidden
"
===
document
.
visibilityState
&&
e
({
timeStamp
:
n
,
isUnloading
:
c
})}),{
capture
:
!
0
,
once
:
t
})},
p
=
function
(
e
,
t
,
n
,
i
){
var
a
;
return
function
(){
n
&&
t
.
isFinal
&&
n
.
disconnect
(),
t
.
value
>=
0
&&
(
i
||
t
.
isFinal
||
"
hidden
"
===
document
.
visibilityState
)
&&
(
t
.
delta
=
t
.
value
-
(
a
||
0
),(
t
.
delta
||
t
.
isFinal
||
void
0
===
a
)
&&
(
e
(
t
),
a
=
t
.
value
))}},
v
=
function
(){
return
void
0
===
i
&&
(
i
=
"
hidden
"
===
document
.
visibilityState
?
0
:
1
/
0
,
f
((
function
(
e
){
var
t
=
e
.
timeStamp
;
return
i
=
t
}),
!
0
)),{
get
timeStamp
(){
return
i
}}},
m
=
function
(){
return
a
||
(
a
=
new
Promise
((
function
(
e
){
return
[
"
scroll
"
,
"
keydown
"
,
"
pointerdown
"
].
map
((
function
(
t
){
addEventListener
(
t
,
e
,{
once
:
!
0
,
passive
:
!
0
,
capture
:
!
0
})}))}))),
a
};
const
y
=
e
=>
{
window
.
ethWebVitals
.
queue
.
push
(
e
)},
g
=
({
id
:
e
,
name
:
t
,
delta
:
n
})
=>
{
const
{
eventCategory
:
i
}
=
window
.
ethWebVitals
.
config
,
a
=
((
e
,
t
)
=>
Math
.
round
(
"
CLS
"
===
e
?
1
e4
*
t
:
t
))(
t
,
n
),
r
=
[
"
send
"
,
"
event
"
,{
eventCategory
:
i
,
eventAction
:
t
,
eventValue
:
a
,
eventLabel
:
e
,
nonInteraction
:
!
0
}];
"
function
"
==
typeof
ga
&&
ga
(...
r
),
"
object
"
==
typeof
_paq
&&
_paq
.
push
([
"
trackEvent
"
,
i
,
t
,
a
]),
console
.
info
(
r
[
2
])};
window
.
addEventListener
(
"
unload
"
,()
=>
{
window
.
ethWebVitals
.
queue
.
map
(
g
)}),
function
(
e
){
var
t
=
arguments
.
length
>
1
&&
void
0
!==
arguments
[
1
]
&&
arguments
[
1
],
n
=
o
(
"
CLS
"
,
0
),
i
=
function
(
e
){
e
.
hadRecentInput
||
(
n
.
value
+=
e
.
value
,
n
.
entries
.
push
(
e
),
r
())},
a
=
u
(
"
layout-shift
"
,
i
),
r
=
p
(
e
,
n
,
a
,
t
);
f
((
function
(
e
){
var
t
=
e
.
isUnloading
;
a
&&
a
.
takeRecords
().
map
(
i
),
t
&&
(
n
.
isFinal
=!
0
),
r
()}))}(
y
),
function
(
e
){
var
t
=
o
(
"
FCP
"
),
n
=
v
(),
i
=
u
(
"
paint
"
,(
function
(
e
){
"
first-contentful-paint
"
===
e
.
name
&&
e
.
startTime
<
n
.
timeStamp
&&
(
t
.
value
=
e
.
startTime
,
t
.
isFinal
=!
0
,
t
.
entries
.
push
(
e
),
a
())})),
a
=
p
(
e
,
t
,
i
)}(
y
),
function
(
e
){
var
t
=
o
(
"
FID
"
),
n
=
v
(),
i
=
function
(
e
){
e
.
startTime
<
n
.
timeStamp
&&
(
t
.
value
=
e
.
processingStart
-
e
.
startTime
,
t
.
entries
.
push
(
e
),
t
.
isFinal
=!
0
,
r
())},
a
=
u
(
"
first-input
"
,
i
),
r
=
p
(
e
,
t
,
a
);
f
((
function
(){
a
&&
(
a
.
takeRecords
().
map
(
i
),
a
.
disconnect
())}),
!
0
),
a
||
window
.
perfMetrics
&&
window
.
perfMetrics
.
onFirstInputDelay
&&
window
.
perfMetrics
.
onFirstInputDelay
((
function
(
e
,
i
){
i
.
timeStamp
<
n
.
timeStamp
&&
(
t
.
value
=
e
,
t
.
isFinal
=!
0
,
t
.
entries
=
[{
entryType
:
"
first-input
"
,
name
:
i
.
type
,
target
:
i
.
target
,
cancelable
:
i
.
cancelable
,
startTime
:
i
.
timeStamp
,
processingStart
:
i
.
timeStamp
+
e
}],
r
())}))}(
y
),
function
(
e
){
var
t
=
arguments
.
length
>
1
&&
void
0
!==
arguments
[
1
]
&&
arguments
[
1
],
n
=
o
(
"
LCP
"
),
i
=
v
(),
a
=
function
(
e
){
var
t
=
e
.
startTime
;
t
<
i
.
timeStamp
?(
n
.
value
=
t
,
n
.
entries
.
push
(
e
)):
n
.
isFinal
=!
0
,
c
()},
r
=
u
(
"
largest-contentful-paint
"
,
a
),
c
=
p
(
e
,
n
,
r
,
t
),
s
=
function
(){
n
.
isFinal
||
(
r
&&
r
.
takeRecords
().
map
(
a
),
n
.
isFinal
=!
0
,
c
())};
m
().
then
(
s
),
f
(
s
,
!
0
)}(
y
),
function
(
e
){
var
t
,
n
=
o
(
"
TTFB
"
);
t
=
function
(){
try
{
var
t
=
performance
.
getEntriesByType
(
"
navigation
"
)[
0
]
||
function
(){
var
e
=
performance
.
timing
,
t
=
{
entryType
:
"
navigation
"
,
startTime
:
0
};
for
(
var
n
in
e
)
"
navigationStart
"
!==
n
&&
"
toJSON
"
!==
n
&&
(
t
[
n
]
=
Math
.
max
(
e
[
n
]
-
e
.
navigationStart
,
0
));
return
t
}();
n
.
value
=
n
.
delta
=
t
.
responseStart
,
n
.
entries
=
[
t
],
n
.
isFinal
=!
0
,
e
(
n
)}
catch
(
e
){}},
"
complete
"
===
document
.
readyState
?
setTimeout
(
t
,
0
):
addEventListener
(
"
pageshow
"
,
t
)}(
e
=>
{
y
(
e
);
const
t
=
e
.
value
-
e
.
entries
[
0
].
requestStart
,
n
=
Object
.
assign
({},
e
);
n
.
name
=
"
TTFB-RT
"
,
n
.
value
=
t
,
n
.
delta
=
t
,
y
(
n
)})}]);
\ No newline at end of file
!
function
(
e
){
var
t
=
{};
function
n
(
i
){
if
(
t
[
i
])
return
t
[
i
].
exports
;
var
a
=
t
[
i
]
=
{
i
:
i
,
l
:
!
1
,
exports
:{}};
return
e
[
i
].
call
(
a
.
exports
,
a
,
a
.
exports
,
n
),
a
.
l
=!
0
,
a
.
exports
}
n
.
m
=
e
,
n
.
c
=
t
,
n
.
d
=
function
(
e
,
t
,
i
){
n
.
o
(
e
,
t
)
||
Object
.
defineProperty
(
e
,
t
,{
enumerable
:
!
0
,
get
:
i
})},
n
.
r
=
function
(
e
){
"
undefined
"
!=
typeof
Symbol
&&
Symbol
.
toStringTag
&&
Object
.
defineProperty
(
e
,
Symbol
.
toStringTag
,{
value
:
"
Module
"
}),
Object
.
defineProperty
(
e
,
"
__esModule
"
,{
value
:
!
0
})},
n
.
t
=
function
(
e
,
t
){
if
(
1
&
t
&&
(
e
=
n
(
e
)),
8
&
t
)
return
e
;
if
(
4
&
t
&&
"
object
"
==
typeof
e
&&
e
&&
e
.
__esModule
)
return
e
;
var
i
=
Object
.
create
(
null
);
if
(
n
.
r
(
i
),
Object
.
defineProperty
(
i
,
"
default
"
,{
enumerable
:
!
0
,
value
:
e
}),
2
&
t
&&
"
string
"
!=
typeof
e
)
for
(
var
a
in
e
)
n
.
d
(
i
,
a
,
function
(
t
){
return
e
[
t
]}.
bind
(
null
,
a
));
return
i
},
n
.
n
=
function
(
e
){
var
t
=
e
&&
e
.
__esModule
?
function
(){
return
e
.
default
}:
function
(){
return
e
};
return
n
.
d
(
t
,
"
a
"
,
t
),
t
},
n
.
o
=
function
(
e
,
t
){
return
Object
.
prototype
.
hasOwnProperty
.
call
(
e
,
t
)},
n
.
p
=
""
,
n
(
n
.
s
=
0
)}([
function
(
e
,
t
,
n
){
"
use strict
"
;
n
.
r
(
t
);
var
i
,
a
,
r
=
function
(){
return
""
.
concat
(
Date
.
now
(),
"
-
"
).
concat
(
Math
.
floor
(
8999999999999
*
Math
.
random
())
+
1
e12
)},
o
=
function
(
e
){
var
t
=
arguments
.
length
>
1
&&
void
0
!==
arguments
[
1
]?
arguments
[
1
]:
-
1
;
return
{
name
:
e
,
value
:
t
,
delta
:
0
,
entries
:[],
id
:
r
(),
isFinal
:
!
1
}},
u
=
function
(
e
,
t
){
try
{
if
(
PerformanceObserver
.
supportedEntryTypes
.
includes
(
e
)){
var
n
=
new
PerformanceObserver
((
function
(
e
){
return
e
.
getEntries
().
map
(
t
)}));
return
n
.
observe
({
type
:
e
,
buffered
:
!
0
}),
n
}}
catch
(
e
){}},
c
=!
1
,
s
=!
1
,
l
=
function
(
e
){
c
=!
e
.
persisted
},
f
=
function
(){
addEventListener
(
"
pagehide
"
,
l
),
addEventListener
(
"
unload
"
,(
function
(){}))},
d
=
function
(
e
){
var
t
=
arguments
.
length
>
1
&&
void
0
!==
arguments
[
1
]
&&
arguments
[
1
];
s
||
(
f
(),
s
=!
0
),
addEventListener
(
"
visibilitychange
"
,(
function
(
t
){
var
n
=
t
.
timeStamp
;
"
hidden
"
===
document
.
visibilityState
&&
e
({
timeStamp
:
n
,
isUnloading
:
c
})}),{
capture
:
!
0
,
once
:
t
})},
p
=
function
(
e
,
t
,
n
,
i
){
var
a
;
return
function
(){
n
&&
t
.
isFinal
&&
n
.
disconnect
(),
t
.
value
>=
0
&&
(
i
||
t
.
isFinal
||
"
hidden
"
===
document
.
visibilityState
)
&&
(
t
.
delta
=
t
.
value
-
(
a
||
0
),(
t
.
delta
||
t
.
isFinal
||
void
0
===
a
)
&&
(
e
(
t
),
a
=
t
.
value
))}},
v
=
function
(){
return
void
0
===
i
&&
(
i
=
"
hidden
"
===
document
.
visibilityState
?
0
:
1
/
0
,
d
((
function
(
e
){
var
t
=
e
.
timeStamp
;
return
i
=
t
}),
!
0
)),{
get
timeStamp
(){
return
i
}}},
m
=
function
(){
return
a
||
(
a
=
new
Promise
((
function
(
e
){
return
[
"
scroll
"
,
"
keydown
"
,
"
pointerdown
"
].
map
((
function
(
t
){
addEventListener
(
t
,
e
,{
once
:
!
0
,
passive
:
!
0
,
capture
:
!
0
})}))}))),
a
};
const
y
=
e
=>
{
window
.
ethWebVitals
.
queue
.
push
(
e
)},
g
=
({
id
:
e
,
name
:
t
,
delta
:
n
})
=>
{
const
{
eventCategory
:
i
}
=
window
.
ethWebVitals
.
config
,
a
=
((
e
,
t
)
=>
Math
.
round
(
"
CLS
"
===
e
?
1
e4
*
t
:
t
))(
t
,
n
),
r
=
[
"
send
"
,
"
event
"
,{
eventCategory
:
i
,
eventAction
:
t
,
eventValue
:
a
,
eventLabel
:
e
,
nonInteraction
:
!
0
}];
"
function
"
==
typeof
ga
&&
ga
(...
r
),
"
object
"
==
typeof
_paq
&&
_paq
.
push
([
"
trackEvent
"
,
"
Performance
"
,
i
,
t
,
a
]),
console
.
info
(
r
[
2
])};
window
.
addEventListener
(
"
unload
"
,()
=>
{
window
.
ethWebVitals
.
queue
.
map
(
g
)}),
function
(
e
){
var
t
=
arguments
.
length
>
1
&&
void
0
!==
arguments
[
1
]
&&
arguments
[
1
],
n
=
o
(
"
CLS
"
,
0
),
i
=
function
(
e
){
e
.
hadRecentInput
||
(
n
.
value
+=
e
.
value
,
n
.
entries
.
push
(
e
),
r
())},
a
=
u
(
"
layout-shift
"
,
i
),
r
=
p
(
e
,
n
,
a
,
t
);
d
((
function
(
e
){
var
t
=
e
.
isUnloading
;
a
&&
a
.
takeRecords
().
map
(
i
),
t
&&
(
n
.
isFinal
=!
0
),
r
()}))}(
y
),
function
(
e
){
var
t
=
o
(
"
FCP
"
),
n
=
v
(),
i
=
u
(
"
paint
"
,(
function
(
e
){
"
first-contentful-paint
"
===
e
.
name
&&
e
.
startTime
<
n
.
timeStamp
&&
(
t
.
value
=
e
.
startTime
,
t
.
isFinal
=!
0
,
t
.
entries
.
push
(
e
),
a
())})),
a
=
p
(
e
,
t
,
i
)}(
y
),
function
(
e
){
var
t
=
o
(
"
FID
"
),
n
=
v
(),
i
=
function
(
e
){
e
.
startTime
<
n
.
timeStamp
&&
(
t
.
value
=
e
.
processingStart
-
e
.
startTime
,
t
.
entries
.
push
(
e
),
t
.
isFinal
=!
0
,
r
())},
a
=
u
(
"
first-input
"
,
i
),
r
=
p
(
e
,
t
,
a
);
d
((
function
(){
a
&&
(
a
.
takeRecords
().
map
(
i
),
a
.
disconnect
())}),
!
0
),
a
||
window
.
perfMetrics
&&
window
.
perfMetrics
.
onFirstInputDelay
&&
window
.
perfMetrics
.
onFirstInputDelay
((
function
(
e
,
i
){
i
.
timeStamp
<
n
.
timeStamp
&&
(
t
.
value
=
e
,
t
.
isFinal
=!
0
,
t
.
entries
=
[{
entryType
:
"
first-input
"
,
name
:
i
.
type
,
target
:
i
.
target
,
cancelable
:
i
.
cancelable
,
startTime
:
i
.
timeStamp
,
processingStart
:
i
.
timeStamp
+
e
}],
r
())}))}(
y
),
function
(
e
){
var
t
=
arguments
.
length
>
1
&&
void
0
!==
arguments
[
1
]
&&
arguments
[
1
],
n
=
o
(
"
LCP
"
),
i
=
v
(),
a
=
function
(
e
){
var
t
=
e
.
startTime
;
t
<
i
.
timeStamp
?(
n
.
value
=
t
,
n
.
entries
.
push
(
e
)):
n
.
isFinal
=!
0
,
c
()},
r
=
u
(
"
largest-contentful-paint
"
,
a
),
c
=
p
(
e
,
n
,
r
,
t
),
s
=
function
(){
n
.
isFinal
||
(
r
&&
r
.
takeRecords
().
map
(
a
),
n
.
isFinal
=!
0
,
c
())};
m
().
then
(
s
),
d
(
s
,
!
0
)}(
y
),
function
(
e
){
var
t
,
n
=
o
(
"
TTFB
"
);
t
=
function
(){
try
{
var
t
=
performance
.
getEntriesByType
(
"
navigation
"
)[
0
]
||
function
(){
var
e
=
performance
.
timing
,
t
=
{
entryType
:
"
navigation
"
,
startTime
:
0
};
for
(
var
n
in
e
)
"
navigationStart
"
!==
n
&&
"
toJSON
"
!==
n
&&
(
t
[
n
]
=
Math
.
max
(
e
[
n
]
-
e
.
navigationStart
,
0
));
return
t
}();
n
.
value
=
n
.
delta
=
t
.
responseStart
,
n
.
entries
=
[
t
],
n
.
isFinal
=!
0
,
e
(
n
)}
catch
(
e
){}},
"
complete
"
===
document
.
readyState
?
setTimeout
(
t
,
0
):
addEventListener
(
"
pageshow
"
,
t
)}(
e
=>
{
y
(
e
);
const
t
=
e
.
value
-
e
.
entries
[
0
].
requestStart
,
n
=
Object
.
assign
({},
e
);
n
.
name
=
"
TTFB-RT
"
,
n
.
value
=
t
,
n
.
delta
=
t
,
y
(
n
)})}]);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
assets/src/web-vitals.js
+
9
−
1
View file @
b874eea8
...
...
@@ -51,7 +51,15 @@ const report = ( {id, name, delta} ) => {
}
if
(
'
object
'
===
typeof
_paq
)
{
_paq
.
push
(
[
'
trackEvent
'
,
eventCategory
,
name
,
value
]
);
_paq
.
push
(
[
'
trackEvent
'
,
'
Performance
'
,
eventCategory
,
name
,
value
]
);
}
console
.
info
(
cbArgs
[
2
]
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment