Title: Split testing only for Mobile devices
Last modified: October 22, 2017

---

# Split testing only for Mobile devices

 *  Resolved [umesh1994](https://wordpress.org/support/users/umesh1994/)
 * (@umesh1994)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/split-testing-only-for-mobile-devices/)
 * Hello,
 * Is it Possible to create split testing only for Mobile?
 * I have one way to achieve this, for testing I just cloned the same page and made
   changes to that variation page required for testing, But this is not adviced 
   way because in the result. It will show the detail for both Desktop and mobile
   test.
 * Is there any way to assign split test only for mobile devices?
 * Thanks,
    Umesh.K

Viewing 1 replies (of 1 total)

 *  [rymera01](https://wordpress.org/support/users/rymera01/)
 * (@rymera01)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/split-testing-only-for-mobile-devices/#post-9613914)
 * Hi Umesh.K,
 * I think you can check if a user is on mobile or not by checking the user agents.
   This page should give you more idea about it: [https://stackoverflow.com/questions/4117555/simplest-way-to-detect-a-mobile-device](https://stackoverflow.com/questions/4117555/simplest-way-to-detect-a-mobile-device).
 * Using that method, you should be able to restrict the split test only on mobile
   devices by using this code in your functions.php file:
 *     ```
       function isMobile() {
           return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
       }
   
       add_action( 'wp_loaded','my_only_mobile_spt' );
       function my_only_mobile_spt() {
           if(!isMobile()){
               remove_action('template_redirect', 'sptRedirect');
           }
       }
       ```
   
 * Please keep in mind that we can only give you an example of code. If you need
   something more complex, I suggest you hire a developer.
 * I hope this helps 🙂
 * Thanks,
    Okky

Viewing 1 replies (of 1 total)

The topic ‘Split testing only for Mobile devices’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-page-tester_677f5d.svg)
 * [Simple Page Tester](https://wordpress.org/plugins/simple-page-tester/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-page-tester/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-page-tester/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-page-tester/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-page-tester/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-page-tester/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [rymera01](https://wordpress.org/support/users/rymera01/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/split-testing-only-for-mobile-devices/#post-9613914)
 * Status: resolved