We'll use alpha
(motion of the device around the z axis, expressed in degrees: 0o to 360o),
beta
(Front to back motion around the x axis, expressed in degrees :-180o to 180o) and
gamma
(Left to right motion around the y axis, expressed in degrees: -90o to 90o)
window.addEventListener('deviceorientation', function(event) {
const alpha = event.alpha;
const beta = event.beta;
const gamma = event.gamma;
...
});