javascript to create unique id for each device

Introduction:

It is not easy to create Unique Identification Number for the visitors who visiting your website or blog. Most of the web developers will use IP Address to identify the users and track them. They use the IP address for tracking return visitors and unique visitors etc. IP address of the user will change according to their network. So, We need something that create an Unique ID for each visitors who visits our website.

Demo Click here Download Click here

How to Create Unique ID Using Javascript:

The java-script code that I displayed below will create the Unique Id for a device. When a user visit your website or app, this script will run and grab some browser details for creating unique identification number. The identification number can be displayed or store to your database as per your wish.
<script>
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);
document.write(uid);
</script>
The above script will generate UID and store it variable uid. The stored UID will be displayed using the "document.write(uid);". You can use the UID variable to store the Unique Identification Number to your database or cookie.
You can use the script to track Unique and Returning visitors. You can also use the script to create unique affiliation links and track. The script will be more powerful if you use JavaScript Cookie with it.

Suggested Articles for Webmasters:

Thanks for reading this article. If you enjoyed this article, Please write your comments also share this article with your friends.Thanks again.

0 comments:

Post a Comment

Wapmaster or Webmaster can Comment Us with the following Comment Box . Don't add Links to your site for Spamming our Blog .. Once you add Comment with Link . It will be deleted immediatly by our Admins .

 
Top