This repository was archived by the owner on Jul 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Assets/WebGLTemplates/WebVR/lib Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ telemetry.performance = {
4646 measure : NO_OP
4747} ;
4848
49- telemetry . start = function ( config ) {
49+ telemetry . start = onlyOnce ( function ( config ) {
5050 config = config || { } ;
5151 if ( config . errorLogging ) {
5252 setupErrorLogging ( ) ;
@@ -57,7 +57,7 @@ telemetry.start = function (config) {
5757 setupPerformanceAPI ( researchAnalytics ) ;
5858 }
5959 }
60- } ;
60+ } ) ;
6161
6262setupAnalytics ( ) ;
6363
@@ -140,7 +140,7 @@ function setupPerformanceAPI(tracker) {
140140 * [2] https://developers.google.com/analytics/devguides/collection/gtagjs/sending-data#groups-and-properties
141141 *
142142 * @param {string } trackingId see `'config'` command signature [1]
143- * @param {onject } options see `'config'` command signature [1]
143+ * @param {object } options see `'config'` command signature [1]
144144 * @returns {function } A tracker function to replace invocation of `gtag` that
145145 * honours Do-Not-Track and automatically adds the `send_to` key to the
146146 * commands [2].
@@ -191,4 +191,14 @@ function doNotTrack() {
191191 window . doNotTrack === '1' ;
192192}
193193
194+ function onlyOnce ( fn ) {
195+ var called = false ;
196+ return function ( ) {
197+ if ( called ) { return ; }
198+ var returnValue = fn . apply ( this , arguments ) ;
199+ called = true ;
200+ return returnValue ;
201+ } ;
202+ }
203+
194204} ) ( window ) ;
You can’t perform that action at this time.
0 commit comments