NAV

Installing Android SDK

Using Maven

<dependency>
    <groupId>com.wootric</groupId>
    <artifactId>wootric-sdk-android</artifactId>
    <version>2.4.7</version>
</dependency>

If you use Maven, you can include this library as a dependency.

Using Gradle

compile 'com.wootric:wootric-sdk-android:2.4.7'

Add the following to your app’s build.gradle file, inside the dependencies section.

Presenting the survey

WootricSDK task is to present a fully functional survey view with just a few lines of code.

Step 1. Add permissions

<uses-permission android:name="android.permission.INTERNET" />

Add the internet permissions to the AndroidManifest.xml file.

Step 2. Add ProGuard rules

-keepattributes *Annotation*, Signature

##== Wootric ==
-keep class com.wootric.** { *; }

##== Retrofit ==
-keep class retrofit.** { *; }
-keepclassmembernames interface * {
    @retrofit.http.* <methods>;
}

Add the following to your ProGuard rules file.

Step 3. Initialize Wootric

import com.wootric.androidsdk.Wootric;

// Inside your method
Wootric wootric = Wootric.init(this, <YOUR_CLIENT_ID>, <YOUR_CLIENT_SECRET>, <YOUR_ACCOUNT_TOKEN>);

// TODO: The current logged in user's email address.
wootric.setEndUserEmail("nps@example.com");
// TODO: The current logged in user's sign-up date as a Unix timestamp.
wootric.setEndUserCreatedAt(1234567890);

// Use only for testing
wootric.setSurveyImmediately(true);

wootric.survey();

First import the SDK into your Activity of choosing. Then configure the SDK with your client ID, secret and account token.

Sign in at wootric.com if you haven’t already. If you just signed up on the Wootric homepage, you will be taken directly to an installation page. If you’re a returning visitor, click on the “Settings" button near the top right of the page. Navigate to the Wootric Installation Guide and you will see a unique account_token for you to use.

The client_id and client_secret can also be found on your Settings page, on the API section.

To display the survey just use wootric.survey();. If the user is eligible (this check is built in the method) the SDK will show the survey.

Step 4. Customize the Survey

Comment out the line wootric.setSurveyImmediately(true) when you are ready for production. Alternatively, leave the line in the code for testing purposes or to survey the customer upon every visit to a view.

import com.wootric.androidsdk.Wootric;
import com.wootric.androidsdk.objects.WootricCustomThankYou;

Wootric wootric = Wootric.init(this, "your_client_id", "your_client_secret", "NPS­-xxxxxxxx");
wootric.setEndUserEmail("nps@example.com");
wootric.setEndUserCreatedAt(1234567890);

// Use only for testing
wootric.setSurveyImmediately(true);

// Customization
WootricCustomThankYou customThankYou = new WootricCustomThankYou();
customThankYou.setText("Merci!");

wootric.setProductName("Wootric");
wootric.setCustomThankYou(customThankYou);
wootric.setLanguageCode("fr");

wootric.survey();

This is an important step! Customize your survey with the name of your product or company. As needed, make changes to our trusted survey and sampling defaults. This values can modified from your app.

Wootric Wootric

Step 5. View your Responses Live!

That’s it! Once the WootricSDK is installed, eligible users will immediately start being surveyed. Depending on the traffic of your app, you could start to see responses within a few minutes. Responses will come in to your Wootric dash in real time.

No data yet?

Checkout the Demo dashboard with dummy data.

Wootric

I’d like to do some testing first. How do I ensure that the survey shows up on demand?

You can easily install Wootric in your development environment for testing. The SDK is already set up to show the survey immediately for testing purposes only.

Additional notes on WootricSDK placement:

For apps with registered users:

If your app has registered users, we recommend that you show the survey only on views that your logged in users will access to allow unique user identification.

For ecommerce apps:

If your app has a checkout flow, we recommend that you show the survey on views that won’t interrupt checkout. The most commonly used location is the transaction completion page.

SDK Reference

setEndUserEmail

wootric.setEndUserEmail(<END_USER_EMAIL>);

While end user email is not required it is HIGHLY recommended to set it if possible.

setEndUserExternalId

wootric.setEndUserExternalId(<END_USER_EXTERNAL_ID>);

Set an external ID for the end user. This value is optional.

setSurveyImmediately

wootric.setSurveyImmediately(<BOOL>);

If setSurveyImmediately is set to true and user wasn’t surveyed yet - eligibility check will return true and survey will be displayed.

setEndUserCreatedAt

wootric.setEndUserCreatedAt(<UNIX Timestamp>);

When creating a new end user for survey, it will set the external creation date (so for example, date, when end user was created in your Android application). This value is also used in eligibility check, to determine if end user should be surveyed.

setFirstSurveyDelay

wootric.setFirstSurveyDelay(<NUMBER_OF_DAYS>);

If not set, defaults to value from admin panel. Used to check if end user was created/last seen earlier than ago and therefore if survey is required.

setProperties

wootric.setProperties(properties);

End user properties can be provided as a HashMap<String, String> object.

shouldSkipFollowupScreenForPromoters

wootric.shouldSkipFollowupScreenForPromoters(<BOOL>);

With this option enabled, promoters (score 9-10) will be taken directly to third (social share) screen, skipping the second (feedback) one.

Custom language, audience text and product name configuration:


wootric.setLanguageCode(<LANGUAGE_CODE>);
wootric.setRecommendTarget(<CUSTOM_AUDIENCE>);
wootric.setProductName(<CUSTOM_PRODUCT_NAME>);

Please refer to our docs for available languages.

setProductName sets the product name for the end user. This will change the default question. e.g. How likely are you to recommend productName to a friend or co-worker? setRecommendTarget will substitute “friend or co-worker”. It also takes precedence over values set in admin panel.

Custom messages

WootricCustomMessage customMessage = new WootricCustomMessage();
customMessage.setFollowupQuestion("custom followup");
customMessage.setDetractorFollowupQuestion("custom detractor");
customMessage.setPassiveFollowupQuestion("custom passive");
customMessage.setPromoterFollowupQuestion("custom promoter");
customMessage.setPlaceholderText("custom placeholder");
customMessage.setDetractorPlaceholderText("custom detractor placeholder");
customMessage.setPassivePlaceholderText("custom passive placeholder");
customMessage.setPromoterPlaceholderText("custom promoter placeholder");

wootric.setCustomMessage(customMessage);

Wootric provides designated class for providing custom messages -WootricCustomMessages

Custom thank you

WootricCustomThankYou customThankYou = new WootricCustomThankYou();
customThankYou.setText("Thank you!!");
customThankYou.setDetractorText("Detractor thank you");
customThankYou.setPassiveText("Passive thank you");
customThankYou.setPromoterText("Promoter thank you");
customThankYou.setLinkText("Thank you link text");
customThankYou.setDetractorLinkText("Detractor link text");
customThankYou.setPassiveLinkText("Passive link text");
customThankYou.setPromoterLinkText("Promoter link text");
customThankYou.setLinkUri(Uri.parse("http://wootric.com/thank_you"));
customThankYou.setDetractorLinkUri(Uri.parse("http://wootric.com/detractor_thank_you"));
customThankYou.setPassiveLinkUri(Uri.parse("http://wootric.com/passive_thank_you"));
customThankYou.setPromoterLinkUri(Uri.parse("http://wootric.com/promoter_thank_you"));
customThankYou.setScoreInUrl(true);
customThankYou.setCommentInUrl(true);
wootric.setCustomThankYou(customThankYou);

Wootric provides designated class for providing custom thank you -WootricCustomThankYou

Color customization (smartphones only)

// Changes background color and text buttons color for the survey
wootric.setSurveyColor(R.color.survey_color);

// Changes score selector color and comment highlight color
wootric.setScoreColor(R.color.score_color);

// Changes Thank You button color on the final view
wootric.setThankYouButtonBackgroundColor(R.color.thank_you_color);

// Changes Facebook and Twitter buttons colors
wootric.setSocialSharingColor(R.color.social_color);

Colors can be customized for the smartphone’s version.

Samples

Rate application on the Play Store


import com.wootric.androidsdk.Wootric;
import com.wootric.androidsdk.objects.WootricCustomThankYou;

...

Wootric wootric = Wootric.init(this, CLIENT_ID, CLIENT_SECRET, ACCOUNT_TOKEN);

wootric.setEndUserEmail("nps@example.com");

// Uncomment for testing
// NOTE: do not use in production
// wootric.setSurveyImmediately(true);

// Will skip the Feedback view for Promoters
wootric.shouldSkipFollowupScreenForPromoters(true);

WootricCustomThankYou customThankYou = new WootricCustomThankYou();
Uri uri = Uri.parse("market://details?id=com.yourcompany.appid");
customThankYou.setPromoterLinkText("Rate our app!");
customThankYou.setPromoterLinkUri(uri);

wootric.setCustomThankYou(customThankYou);
wootric.survey();

You can set the last button to go to the Play Store so users can rate your app.

Wootric

Set End User Properties

import com.wootric.androidsdk.Wootric;
import com.wootric.androidsdk.objects.WootricCustomThankYou;
import java.util.HashMap;

...

Wootric wootric = Wootric.init(this, CLIENT_ID, CLIENT_SECRET, ACCOUNT_TOKEN);

wootric.setEndUserEmail("nps@example.com");

// Uncomment for testing
// NOTE: do not use in production
// wootric.setSurveyImmediately(true);

// Set end user's properties
HashMap<String, String> properties = new HashMap<String, String>();
properties.put("company", "Wootric");
properties.put("type", "awesome");
properties.put("os", "Android");
// Integer representing the date (Unix timestamp format) of the user's last order with the key suffixed with "_date"
properties.put("last_order_date", "1479316287");
// Integer representing the user's total purchases with the key suffixed with "_amount"
properties.put("total_purchase_amount", "10");
wootric.setProperties(properties);

wootric.survey();

Setting end user properties will help you segment and filter results.

Wootric currently supports Integers, Strings, and Unix formatted dates as values.

Integers must be suffixed with _amount and dates must be in Unix timestamp format and suffixed with _date.

Keys cannot contain characters such as ‘$’, ‘.’ or the NULL character. Values cannot be nested hashes or arrays.

Properties

Troubleshooting

Survey not showing up?

Check that client ID, client secret and account token are correct. Account token should have a “NPS-xxxxxxxx” format

Does the SDK work with Amazon devices?

Yes, the SDK has been tested with Amazon devices.

I’m using setSurveyImmediately but getting User not eligible

Check that Wootric Mobile Switch is enabled on your Acount Settings

Wootric

Segment Integration

Wootric provides an integration for Segment. The library can be found on our Github.

This library is distributed as Android library project so it can be included by referencing it as a library project.

Install with Maven

<dependency>
    <groupId>com.wootric</groupId>
    <artifactId>analytics-integration-wootric</artifactId>
    <version>0.1.4</version>
</dependency>

If you use Maven, you can include this library as a dependency.

Install with Gradle

compile 'com.wootric:analytics-integration-wootric:0.1.4'

dependencies {
  repositories {
    mavenCentral()
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
  }

  compile 'com.segment.analytics.android:analytics:4.1.4-SNAPSHOT'
}

It is assumed that Segment’s android analytics is available. The latest version can be added as dependency this way.

Intialize Analytics

import com.segment.analytics.Analytics;
import com.wootric.analytics.android.integrations.wootric.WootricIntegration;

public class MainApplication extends Application {

    Analytics analytics;

    @Override
    public void onCreate() {
        super.onCreate();

        analytics = new Analytics.Builder(this, "write_key")
                .use(WootricIntegration.FACTORY)
                .build();
    }

    public Analytics getAnalytics() {
        return analytics;
    }
}

Analytics object should be initialized in the Application class, specifying that the WootricIntegration should be user.

Wootric object


import com.segment.analytics.Analytics;
import com.wootric.analytics.android.integrations.wootric.WootricIntegration;
import com.wootric.androidsdk.Wootric;

public class MainActivity extends Activity {
    @Override
    protected void onResume() {
        super.onResume();

        Analytics analytics = ((MainApplication) getApplication()).getAnalytics();
        analytics.onIntegrationReady(WootricIntegration.FACTORY.key(), new Analytics.Callback<Wootric>() {
            @Override
            public void onReady(Wootric wootric) {
                // Set all aptional configuration here like:
                // wootric.setSurveyImmediately(true);
                // wootric.setLanguageCode("PL");
                wootric.survey();
            }
        });
    }
}

In your Activity of choosing the Wootric object can be used to set all optional configurations and call survey() method.

mParticle Integration

Wootric provides an integration for mParticle.

Instructions on how to setup the mParticle Android SDK can be found on mParticle’s Github.