AppTunnel Documentation


This documentation will help you with setting up and usage of the AppTunnel iOS and Android sdks, as well as usage of our platform in general.

If you have any questions or problems regarding the implementation of our sdks or usage of our platform, please do not hesitate to contact us at support@apptunnel.com

- Installation

You can start using AppTunnel just in minutes, our sdks are easy to integrate. Just follow the steps below.

1- CocoaPods Installation

AppTunnel available via CocoaPods

- Add AppTunnel to your pod file like shown below.

pod 'AppTunnel'

- Run pod install:

pod install

- Open your project using, xcworkspace file.

Learn more about cocoapods here

2- Manuel Installation

AppTunnel framework is available on Github.

- We have 2 frameworks for iOS. One is for objective-c, the other one is written for swift developers.

Download iOS framework for objective-c
Download iOS framework for swift

- Download the framework project from the links above and unzip it.

- Open your project, drag and drop the AppTunnel.framework into Embbedded Binaries section.

- Check "Copy items if needed" and click finish.

- Create a new “Run Script Phase” in your app’s target’s “Build Phases” and paste one of the following snippets in the script text field:

bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppTunnel.framework/strip-framework.sh"
bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppTunnelSwift.framework/strip-framework.sh"

You’ve finished the installation of AppTunnel and you are ready to start using it!

Maven Installation

AppTunnel's Android sdk is available on github.

https://github.com/apptunnel/apptunnel-android-sdk

- Open your module's build.gradle and add the url of our sdk.

repositories {
	maven {
		url "https://github.com/apptunnel/apptunnel-android-sdk/raw/master/"
	}
}

- Go to dependencies of your module's build.gradle and add AppTunnel dependencies like below.

dependencies {
	
	// Dependency for AppTunnel
	compile("sdk.apptunnel.com:apptunnel:1.0.0");
	
}

- Compile and sync the gradle and you are done with installation of AppTunnel sdk for Android.


- Fetching Results

Fetching a/b test and feature flag results for users is easy and straightforward with AppTunnel's sdks. You can find examples below for objective-c, swift and android (Java).

1- Start AppTunnel
#import  <AppTunnel/AppTunnel.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
	[AppTunnel startAppTunnelWithApiKey:@"REPLACE_WITH_YOUR_API_KEY"
                             projectKey:@"REPLACE_WITH_YOUR_PROJECT_KEY"
                            environment:kAppTunnelEnvironmentSandbox];
}
						

2- Fetch A/B Tests And Feature Flags

Let's fetch results for 2 a/b tests and 2 feature flags that we are using in our app. A/b tests' ids are "XY2", "XZ6" and feature flags' ids are "AT7" and "AY8".

NSArray *abTestIds = @[@"XY2", @"XZ6"];
NSArray *featureFlagIds = @[@"AT7", @"AY8"];

[AppTunnel getVariationsForABTests:abTestIds
                      featureFlags:featureFlagIds
                    withFetchBlock:^(NSArray *abTests, NSArray *featureFlags, NSError *error) {

}];
1- Start AppTunnel
import AppTunnelSwift
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
{
	AppTunnel.startAppTunnel(apiKey: "REPLACE_WITH_YOUR_API_KEY",
                         projectKey: "REPLACE_WITH_YOUR_PROJECT_KEY",
                        environment: kAppTunnelEnvironmentSandbox)
}
						

2- Fetch A/B Tests And Feature Flags

Let's fetch results for 2 a/b tests and 2 feature flags that we are using in our app. A/b tests' ids are "XY2", "XZ6" and feature flags' ids are "AT7" and "AY8".

let abTestIds = ["XY2", "XZ6"]
let featureFlagIds = ["AT7", "AY8"]

AppTunnel.getVariations(abTests: abTestIds, featureFlags: featureFlagIds) { (abTestResults, featureFlagResults, error) in

}
1- Start AppTunnel
public class MyApplication extends Application {

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

        AppTunnel.startAppTunnel(this, 
				"REPLACE_WITH_YOUR_API_KEY", 
				"REPLACE_WITH_YOUR_PROJECT_KEY", 
				AppTunnelEnvironment.ENVIRONMENT_SANDBOX);
    }

}

2- Fetch A/B Tests And Feature Flags

Let's fetch results for 2 a/b tests and 2 feature flags that we are using in our app. A/b tests' ids are "XY2", "XZ6" and feature flags' ids are "AT7" and "AY8".

ArrayList<String> abTestIds = new ArrayList<String>() { {
    add("XY2");
    add("XZ2");
} };
ArrayList<String> featureFlagIds = new ArrayList<String>() { {
    add("AT7");
    add("AY8");
} };

AppTunnel.getVariations(abTestIds, featureFlagIds, new AppTunnelResultsFetchedInterface() {
    @Override
    public void onResultsFetched(ArrayList<ATABTestResult> arrayList, ArrayList<ATFeatureFlagResult> arrayList1, Error error) {

    }
});

- Setting UserId

Each user can get a user id (non-unique, string) This user id can be used later on our control panel to find the details of this user, change a/b test and feature flag variations it gets.

- Setting UserId

[AppTunnel setUserId:@"acmeuser@gmail.com"];

- Setting UserId

AppTunnel.setUserId(userId: "acmeuser@gmail.com")

- Setting UserId

AppTunnel.setUserId("acmeuser@gmail.com");


- Creating a Project

You can create a new project easiliy on AppTunnel's control panel. Simply login to your AppTunnel account and on projects section, click on "Create a new project" button.

Project's should be per apps. We advice you to create one project per app. Later you can create A/B Tests and Feature Flags for projects.

You will need to fill project name and choose the project's environment as either Apple or Android.


- Finding your API credentials

API credentials are created per project. For each project you will need to use different API Key and Project Key.

You can find API credentials on your project's "Api Credentials" section.


- A/B Testing

Use A/B Testing when you want to test different variations on your applications. While product is called A/B Testing, it is possible to create up to 10 different variations on AppTunnel's A/B Testing platform.

Creating an A/B Test

You can create an A/B Tests per project basis. Simply go to your project's page and click on "Create"

Enter a name for your A/B Test and start creating variations. You can create up to 10 variations on A/B Tests.

For each variation you will need to enter a name, choose percentages for production and sandbox environments.

Json values are optional. You can use json values when you need to pass different kinds of dynamic variables together with variations. You can change the json values whenever you want.

Created A/B Test firstly will be on "Draft" stage. At this stage A/B Test can be used by Sandbox users over our sdks. You will need to Launch the A/B Test in order to use it for production. Once an A/B Test launched, it can be both used by Production and Sandbox users.


Setting a Winner

When you decide with which variation to go, you can simply go to detail of the A/B Test and set a winner. In this case all your users will receive the selected variation.


- Feature Flags

Use Feature Flags for turning on and off a feature, or switching between different functionality. It is possible to create up to 10 variations on AppTunnel's Feature Flags.

Creating a Feature Flag

You can create Feature Flags per project basis. Simply go to your project's page and click on "Create"

Enter a name for your Feature Flag and start creating variations. You can create up to 10 variations on Feature Flags.

For each variation you will need to enter a name and choose percentages for Production and Sandbox environments.

Json values are optional. You can use json values when you need to pass different kinds of dynamic variables together with variations. You can change the json values whenever you want.

Created Feature Flag firstly will be on "Draft" stage. At this stage Feature Flag can be used by Sandbox users over our sdks. You will need to Launch the Feature Flag in order to use it for production. Once an Feature Flag launched, it can be both used by Production and Sandbox users.


Changing Distributions

You can change the distributions of the variations on your Feature Flags whenever you need. Simply go to Feature Flag's detail page and click to "Change Distribution" button.

When you turn on "Re-Shuffling" flag AppTunnel will change old user's distribution and in order to reach new distribution percentages.

If "Re-Shuffling" flag is off, new distribution will be reached with new users joining to Feature Flag. Old users will keep their variations as they are.


If you have any questions or problems regarding the implementation of our sdks or usage of our platform, please do not hesitate to contact us at support@apptunnel.com