const measureDuration = ( mark , optReference ? ) => { const reference = optReference || 'responseEnd' ; const name = `${ reference }:${ mark }` ; window . performance . clearMeasures ( name ) ; window . performance . measure ( name , reference , mark ) ; const measure = window . performance . getEntriesByName ( name ) [ 0 ] ; return measure . duration ; } ; window . onload = ( ) => { const indexRenderTime = measureDuration ( 'index.html' ) ; if ( indexRenderTime ) { ga ( 'send' , 'timing' , 'index.html' , 'render' , indexRenderTime ) ; } } ;