Skip to content

Growth

Introduction

StreetHawk Growth feature lets your user share your application with friends. Also, the feature can be extended to invite the new user to a deep linked page inside your application. Create a Share button inside your application and call InviteFriendsToDownloadApplication to generate the share URL. StreetHawk SDK will then ask user ways to share the generated URL. That is (email, post on Facebook etc). Below are the APIs which generates sharable URL. A scheme for deep linking is required for StreetHawk growth.

Integration Steps

Integration of StreetHawk's Analytics module is prerequisite for this module. Click here for the document on StreetHawk Analytics module.

  • Add dependencies

For Android Studio as your IDE, add the following code in application's build.gradle file under dependencies.

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
...
...
    compile 'com.streethawk:growth:1.8.22'
}
  • Register Scheme in AndroidManifest.xml

Register scheme, host and other parameters required to deep link into your application.

<activity
    android:name=".MyActivity"
    android:label="@string/title_activity_set_params">
    <intent-filter android:label="SetParams">
        <action android:name = "android.intent.action.VIEW" />
        <category android:name = "android.intent.category.BROWSABLE"/>
        <category android:name = "android.intent.category.DEFAULT"/>
                <data
                    android:scheme="SCHEME"
                    android:host="HOST"
                    android:pathPrefix="PATH_PREFIX"
....
....
                    </data>
    </intent-filter>
</activity>
  • Register Growth plugin for your application

Register StreetHawk's growth module with StreetHawk SDK and call init as shown below in onCreate function of your application's launcher activity.

import com.streethawk.library.core.StreetHawk;
import com.streethawk.library.growth.Growth;

....
....

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
...
...
        Application app = getApplication();
        StreetHawk.INSTANCE.setAppKey(<APP_KEY>);
        StreetHawk.INSTANCE.init(app);
    }
  • Fetch and share the universal shareable link.

Call originateShareWithCampaign to generate the universal shareable link which your application user can share with his friends.

Button share = new Button(this);
        share.setText("Share");
        share.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String ID = "ShareViaFacebook";
                String shareLink = "recipeApp://homepage?recipe=chocolatechipcookie";
                String utm_source = "Facebook";
                String utm_medium = "cpc";
                String utm_term = "facebookAdd";
                String campaign_content = "best chocolate chip cookie recipe";
                String default_ur = "http://recipeApp.com/chocolatechipcookie";

                Growth.getInstance(this).originateShareWithCampaign(ID,shareLink, utm_source, utm_medium, utm_term, campaign_content, default_ur, new IGrowth() {
                            @Override
                            public void onReceiveShareUrl(String shareUrl) {
 Intent intent = new Intent(Intent.ACTION_SEND);
                    intent.setType("text/plain");
                    intent.putExtra(Intent.EXTRA_TEXT,shareUrl);
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    mContext.startActivity(intent);       // Launch default application picker
                            }
                            @Override
                            public void onReceiveErrorForShareUrl(JSONObject errorResponse) {

                            }
                        });
            }
        });
}
Variable Description
utm_campaign ID to be used in StreetHawk analytics
URI Deeplink URI of the page which needs to be deep linked
utm_source source where URL will be posted. (Example facebook)
utm_medium medium for posting the URL (Example cost per click or CPC)
utm_term Keywords for campaign (Example facebook adv)
campaign_content Description of campaign (Example 5 minutes chocolate chip cookie)
default_url Fallback URL for non-supported platforms (Example http://www.recipeapp.com/recipe/112233)
object Implementation of IGrowth object. If null, SDK will invoke StreetHawk app picker and catch the utm_source as per user's selection.

As shown above, the universal shareable URL returned by StreetHawk is received as shareURL in onReceiveShareUrl function.

Knowledge Base Articles