Skip to content

Commit

Permalink
track duration of xr session
Browse files Browse the repository at this point in the history
  • Loading branch information
cabanier committed Oct 19, 2023
1 parent 5494cf0 commit 66ddb90
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions map.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ AFRAME.registerComponent("map", {

init: function() {
this.frame = 0;
this.XRStart = 0;
this.playerTile = { x: 1000, y: 1000 };
this.playerAdjacentTileIds = [];
this.tileOffset = 0.5 * this.data.tileSize;
Expand Down Expand Up @@ -47,6 +48,14 @@ AFRAME.registerComponent("map", {
if (model_name === 'Quest 3') {
this.renderer.xr.setFoveation(0);
}


this.XRStart = performance.now();
});

document.querySelector('a-scene').addEventListener('exit-vr', function () {
gtag('event', 'exit-vr', { duration: Math.floor((performance.now() - this.XRStart)/1000) });
this.XRStart = 0;
});

this.throttledEmitComponentChanged = function emitChange () {};
Expand Down

0 comments on commit 66ddb90

Please sign in to comment.