php – Identifying a real mobile device


Everyone knows that there are more bots on the network, if not, then on a par with real users, so for sure. The task for a web-project especially for mobile devices is to try to minimize the presence of bots.

The problem with using user-agent is that the same developer tools successfully mimic them. There is a script implementation that reads data from the device's gyroscope (I will give it below), but the javascript api does not quite work correctly in older versions of Android …

Are there any other options for determining the reality of the device, besides the one given by me? Interested in both client and server implementations.

var gyroPresent = null;
window.addEventListener("devicemotion", function(event) {
  if (event.rotationRate.alpha || event.rotationRate.beta || event.rotationRate.gamma) {
     gyroPresent = true;
  else {
     gyroPresent = false;
  if (gyroPresent === false) {
     alert('Нет гироскопа');


Alternatively, read the screen dimensions. Bots do not have a screen)) In general, 99% of bots do not process javascript. So if js works, with a high degree of probability, we can assume that it is not a bot.

Scroll to Top