SIGN IN YOUR ACCOUNT TO HAVE ACCESS TO DIFFERENT FEATURES

FORGOT YOUR PASSWORD?

FORGOT YOUR DETAILS?

AAH, WAIT, I REMEMBER NOW!

The API CompanyThe API Company

  • Home
  • API’s
    • Device detection API
    • IP Location API
  • FAQ
  • Contact
  • Blog
  • My account
SIGN IN
  • No products in cart.
  • Home
  • Blog
  • Device detection
  • JavaScript Device Detection – Features
Sunday, 24 February 2019 / Published in Device detection

JavaScript Device Detection – Features

Tweet
Pin
Share

Last week we launched the device detection API. This API is a JavaScript device detection implementation to discover information about the users on your website. More specifically, you are able to detect the type of device, name of device, touchscreen information, and more. Additionally, it is possible to detect information about the user’s browser. In the last post we described how the API is able to detect these device features. In this post we look at what features are available and how to implement them.

JavaScript snippet with code to detect the device name

What features are available:

Currently, it is possible to detect 13 different device characteristics. However, we are constantly updating our API to detect even more information. Until this moment, the following features can be detected:

  • The type of device
  • Device brand
  • Device name
  • Screen height
  • Screen width
  • Pixel density / Screen Ratio
  • GPU
  • Browser name
  • Browser version
  • OS name
  • The version of the OS
  • Touchscreen capabilities

Let us know if you have more features you want to be added to this list.

Implementation in JavaScript

On our homepage you find the JavaScript code for implementing the device detection API. The API is free and no licence key is needed. There are two different methods available. The synchronous implementation and the asynchronous. To implement the first method, just copy-paste the following line in the <head> tags of your website:


<script src=“https://theapicompany.com/deviceAPI.js?id=XXX”></script>


Alternatively, the asynchronous is available to improve efficiency and reduce loading times. Just copy-paste the following code in the <head> tags of your website.


<script async src=“https://theapicompany.com/deviceAPI2.js?id=XXX”></script>

Once included several variables can be accessed to detect the device information of the user. These variables are described in the following paragraph.

Device detection variables

Once included in your HTML code you can access the features above. Each piece of information is stored in a variable. These variables have the following names:

FeatureVariable nameExample return
Device typedeviceAPI.deviceTypemobile
Device branddeviceAPI.deviceBrandApple
Device namedeviceAPI.deviceNameiPhone XS
Screen heightdeviceAPI.screenHeight800
Screen widthdeviceAPI.screenWidth400
Pixel density / Screen RatiodeviceAPI.screenRatio2
GPUdeviceAPI.GPUApple GPU
Browser namedeviceAPI.browserNameChrome
Browser versiondeviceAPI.browserName71.0.3578.99
OS namedeviceAPI.osNameOS X Yosemite 10.10
OS versiondeviceAPI.osCodeName10.10.5
TouchscreendeviceAPI.osCodeNameTRUE

As you see it is very easy to implement the device detection API. Check our homepage to see how you can implement it for your website!

Conclusion and future blog posts

The device detection API is a very easy JavaScript tool. This tool enables web developers to easily optimise the UX. For example, the API can be used to route mobile users to a specific page. More of these use-cases will be described in future blog posts. Additionally, we will cover tutorials with Google Tag Manager.

Tweet
Pin
Share
Tagged under: API, device detection, javascript, theapicompany

Recent Posts

  • REST & SOAP API USAGE IN 2020

    This infographic illustrates REST and SOAP API ...
  • What is API: Application programming interface

    What is an API API stands for Application progr...
  • What is an IP address: concept & technology

    IP-address is short for “Internet protoco...
  • What is geolocation: History and use-cases

    A brief history For already thousand of years p...
  • New: Geolocation detection API

    Today we launched a new API for our platform: T...

Archives

  • April 2020
  • March 2020
  • February 2020
  • March 2019
  • February 2019

Categories

  • API
  • AWS
  • browser detection
  • Company information
  • Device detection
  • geolocation
  • IP-address
  • JavaScript
  • new devices
  • User-Agent String
Links
Blog
Device Detection API
IP Location API
Privacy Policy
Information
Contact
About
FAQ
Sitemap

© 2021 - The API Company

VAT NR: NL002318093B93 - DataClick

TOP