Express Detection : With Wordpress

Device Detection with WordPress

Login to Handset Detection, create your site and setup any redirection rules. After you’ve completed that grab the Site ID, this is the unique id which we use to reference your site internally.

Paste the script below into your wordpress theme’s function.php file by Logging in to WordPress, then click Dashboard > Appearance > Editor. From the menu on the right hand side choose the Theme Functions (functions.php) file.

Copy the snippet below and paste it into the very end of the file. After pasting, substitute your Site ID for xxx, then save the file.

 ** Handset Detection
if (! is_admin()) {
    wp_enqueue_script('handsetdetection', '', '1' , 0);

Job done ! Now test.

This snippet ensures that detection will only take place on the standard pages for the WordPress website, not the admin pages. For best results enable Smart Redirection on your site profile in Handset Detection.

Get Started Today

Our free Express / Cloud plan has 20,000 detections per month. No credit card required. Upgrade when you're ready. We also have a free Community Edition for Ultimate Detection, our high performance local detection library, which you can build into community open source projects.

Get Started. Its Free