How to tell apart mobile and desktop subscribers?

tech
android
ios
how-to
marketing
web

#1

You have a Web project or a project mixing a mobile application and a website and you wish to segment either mobile users or desktop users to provide them with content curated specifically for the mobile use or higher desktop screen sizes.

The best way to address this problem is to set a string_deviceType custom property for each user after initializing the SDKs, with the appropriate value: mobile or desktop.

Thus, for a user visiting your website via his mobile phone, you must integrate the following code:

WonderPush.ready(function(WonderPushSDK){
    WonderPushSDK.putInstallationCustomProperties({
        string_deviceType: navigator.userAgent.toLowerCase().match(/iphone|ipad|ipod|android/) === null ? "desktop" : "mobile",
    });
});

On your Android application, add the following code:

JSONObject custom = new JSONObject();
custom.put("string_deviceType", "modile");
WonderPush.putInstallationCustomProperties(custom);

On your iOS application, add the following code:

[WonderPush putInstallationCustomProperties:@{@"string_deviceType": @"mobile"}];

Then you will be able to create two segments using the value of this new installation property.


#2