Using Campaign Landers with the Tapstream Android SDK
First, integrate the latest Android SDK.
Integration instructions for Android
Tapstream Campaign Landers let you automatically display a landing page to your users in a customizable, in-app modal.
You can provide a custom URL, some custom HTML, or use our lander builder to produce landers on the fly. You can add new landers and associate existing landers with advertising or marketing campaigns, without having to release app updates.
Using the Lander Builder
In most cases, you will want to use Tapstream's in-dashboard lander builder for your landing pages. The builder provides a variety of options to create a mobile-optimized lander. Within the lander builder, you'll find a field to provide a form action; this is the address to which your lander form will POST when it is submitted. You will want to point this at a service or server you control to collect the data and use it how you like.
The builder includes automatic support for MailChimp forms. To use a MailChimp form, enable the "Use MailChimp" toggle and provide your form action, user ID and list ID, along with the styling options for the automatically-generated email collection field. You can add additional fields from your Mailchimp list as regular form fields, as long as you match the field names (likely "MERGE1", "MERGE2", etc.)
Advanced Usage
If the lander builder doesn't suit your needs, you can provide either custom HTML or a custom URL to your lander.
SDK Integration
You can use Campaign Landers on Android by intgrating Tapstream's SDK. First, enable Campaign Landers upon initializing Tapstream:
Config config = new Config("ACCOUNT_NAME", "SDK_SECRET"); config.setUseInAppLanders(true); Tapstream.create(getApplication(), config);
Then, at any time (usually during startup, after initializing Tapstream), you can retrieve and then display associated Campaign Landers:
// In a method in your main activity final Activity mainActivity = this; ApiFuture<LanderApiResponse> resp = Tapstream.getInstance().getInAppLander(); resp.setCallback(new Callback<LanderApiResponse>() { @Override public void success(LanderApiResponse result) { final Lander lander = result.getLander(); runOnUiThread(new Runnable() { @Override public void run() { View parent = findViewById(R.id.main_layout); // For example Tapstream.getInstance().showLanderIfUnseen(mainActivity, parent, lander); } }); } @Override public void error(Throwable reason) {} });
If a Lander exists for this user, it will be displayed in a full-screen WebView window. Navigating away from the lander will close it.
The lander cannot not be shown before the app has finished launching, or before Tapstream has finished
initializing. If you would like to display the lander on application start-up, the
applicationDidBecomeActive
lifecycle hook is a good place for this, presuming that Tapstream was initialized during applicationDidFinishLaunchingWithOptions
.
Remember that any given lander will only be shown once per user.
Customizing behavior
For more control, you can implement com.tapstream.sdk.landers.ILanderDelegate
, which looks
like this:
class MyLanderDelegate implements ILanderDelegate { @Override public void showedLander(Lander lander) { } @Override public void dismissedLander() { } @Override public void submittedLander() { } }
You can pass your delegate as a fourth argument to showLanderIfUnseen
.
The first method, showedLander
, is called when a lander is displayed, with that lander's
numeric ID. The second, dismissedLander
, is called when the lander is dismissed via the
close button in the top right corner. The final method, submittedLander
is called when the form is submitted.