Basic Integration
Once you have downloaded the library and obtained your licence key, you can integrate DeviceAssure into your website with just a few lines of code.
Step 1: Include the Library
Add the DeviceAssure JavaScript library to your webpage. It is recommended to include it at the end of your page:
Step 2: Initialize DeviceAssure
Create an initialization function that calls DeviceAssure.load() with your licence key:
<script type="text/javascript">
function onDeviceAssureLoad() {
var args = {
licence: '<LICENCE_KEY>',
imei: '<IMEI>', // optional
storageType: 'cookie', // override 'local-storage' default to 'cookie'
onSuccess: function(response) {
console.log('Handle successful response here.', response);
},
onError: function(error) {
console.log('Handle error or failed response here.', error);
}
};
DeviceAssure.load(args);
}
</script>
<!-- Note how the configs are defined before the import of the DeviceAssure script -->
<script src="<path/to/deviceAssure.min.js>" defer async onload="onDeviceAssureLoad()"></script>
Complete Example
Here is a complete minimal integration example:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<!-- Your page content -->
<!-- DeviceAssure Integration -->
<script type="text/javascript">
function onDeviceAssureLoad() {
var args = {
licence: '<LICENCE_KEY>',
imei: '<IMEI>', // optional
storageType: 'cookie', // override 'local-storage' default to 'cookie'
onSuccess: function(response) {
console.log('Handle successful response here.', response);
},
onError: function(error) {
console.log('Handle error or failed response here.', error);
}
};
DeviceAssure.load(args);
}
</script>
<!-- Note how the configs are defined before the import of the DeviceAssure script -->
<script src="<path/to/deviceAssure.min.js>" defer async onload="onDeviceAssureLoad()"></script>
</body>
</html>
Important: For accurate device detection on Chromium-based browsers (Chrome, Edge, etc.), your site should be served over HTTPS. This enables collection of client-hints data which improves detection accuracy.
See Also
For more advanced integration options, see:
- QR Code Quick Start Guide - Verify mobile devices via QR code scanning
- Client to Server Usage - Direct validation from the browser
- Server to Server Usage - Validation via your backend server
- Configuration Options - Customizing cache, storage, and tags
- Sample Application - Working examples included in the library package