Skip to content



StreetHawk's Analytics Component is core component of StreetHawk SDK. The module reports various vital raw data to StreetHawk servers which is further processed and used for various analytics for your application. The module also provides API for tagging the install, identifying the users and tracking various important events inside your application. All other components of StreetHawk depends on Analytics component for it's functioning.

Integration Steps

  • Include StreetHawkAnalytics Component

1.In Xamarin Studio, double click on Components folder
2.Click on "Get More Components" and search for StreetHawk Analytics. Click Add to App
3.Once downloaded, click on Add to Project

  • Modify AndroidManifest.xml

Open AndroidManifest.xml (located inside Properties folder) of your application. Add the following permissions under the Manifest tag


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



Also add the following code under Application tag of AndroidManifest.xml


                android:exported="true" >
                    <action android:name="android.location.PROVIDERS_CHANGED" />
                    <action android:name="android.intent.action.TIMEZONE_CHANGED" />
                    <action android:name="android.intent.action.BOOT_COMPLETED" />
                    <action android:name="" />
                    <action android:name="com.streethawk.intent.action.gcm.STREETHAWK_APP_STATUS_CHK" />

            android:exported="true" >

  • Initialise StreetHawk

Include StreetHawk component adding following statement

using Com.Streethawk.Library.Core;

Add the following code in OnCreate function of Launcher class of your application.

[Activity (Label = "XamHawkAnalytics", MainLauncher = true, Icon = "@mipmap/icon")]
    public class MainActivity : Activity
        int count = 1;

        protected override void OnCreate (Bundle savedInstanceState)
            Xamarin.Insights.Initialize (XamarinInsights.ApiKey, this);
            base.OnCreate (savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            StreetHawk.Instance.SetAppKey ("<APP_KEY>"); //Replace with your application's AppKey
            StreetHawk.Instance.Init (Application);

Identify Your App Users

  • Tagging customer's unique ID
string cuid = ""; // using user's email address cuid
  • Tagging customer's first name
string key = "sh_first_name";
string name = "David";
  • Tagging customer's email address
string key = "sh_email";
string email = "";

Tag Events Inside Application

  • String value
string key = "ProductOffer";
string value = "Liked";
  • Numeric Value
string key = "BidValue";
int value = 554.95;
  • DateTime Value
// Example code using pre-defined StreetHawk keys
string key = "sh_registered";
string datetime_value = "2014-07-25 15:33:20";
StreetHawk.Instance.TagDatetime(key, datetime_value); // string Date time value in UTC
// Example code using custom tag
string key = "Birthday";
string string_value = "2014-07-25 15:33:20";
StreetHawk.Instance.TagDatetime(key, datetime_value);
  • Increment Tag's value
string key = "LikeButtonPressed";
  • Remove Tag
string key = "RemoveUser";

Track User Entering and Exiting View

  • View Enter

Call NotifyViewEnter when user enters a view. Following is the sample code for the same

StreetHawk.Instance.NotifyViewEnter ("<Add_VIEW_NAME>");
  • View Exit

Call NotifyViewExit when user exits a view. Following is the sample code for the same

StreetHawk.Instance.NotifyViewExit ("<ADD_VIEW_NAME>");