Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Javascript to get unique id for devices
#1
Hello guys.

Today I am going to share a code which helps you to create unique id for each device that browse your website. By using this script, you can track your new visitors, returning visitors etc.

Code:
var navigator_info = window.navigator;
var screen_info = window.screen;
var uid = navigator_info.mimeTypes.length;
uid += navigator_info.userAgent.replace(/\D+/g, '');
uid += navigator_info.plugins.length;
uid += screen_info.height || '';
uid += screen_info.width || '';
uid += screen_info.pixelDepth || '';
console.log(uid);

I hope this helps you. 

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)