Integrating the Tapstream Xamarin SDK

First, download the latest Xamarin SDK.

Download the latest Xamarin SDK

This document assumes you are using Xamarin to target both Android and iOS.

Integrating the SDK

  • Download and extract the Tapstream Xamarin SDK.
  • Add TapstreamAndroid.dll to your Xamarin Android project and allow the DLL to be copied to your project directory.
  • Add TapstreamiOS.dll to your Xamarin iOS project and allow the DLL to be copied to your project directory.
  • In your Xamarin Android project options (under Build > Android Application), make sure that the following permissions are checked: Internet, AccessWifiState, and ReadPhoneState.

Importing and initializing the SDK

Initialize the SDK by calling Tapstream's Create method. This code should go in your app's OnCreate (Android) or FinishedLaunching (iOS) method.

using TapstreamMetrics;

...

Config conf = new Config();

// For the iOS case only:
conf.Set("idfa", "<IDFA goes here>");

Tapstream.Create("TAPSTREAM_ACCOUNT_NAME", "TAPSTREAM_SDK_SECRET", conf);

We strongly recommend that you collect and provide the iOS Advertising Identifier (IDFA) value to the Tapstream SDK. Please see Apple's documentation on collecting the IDFA.

Firing extra events

By default, Tapstream fires an event whenever the SDK is initialized. You can define further events for recording key actions in your app by using the syntax below:

// Regular event:
Event e = new Event("test-event", false);
Tapstream.FireEvent(e);

// Regular event with custom parameters:
Event e = new Event("test-event", false);
e.AddPair("my-custom-param", 3);
Tapstream.FireEvent(e);

// One-time-only event:
Event e = new Event("test-event", true);
Tapstream.FireEvent(e);

// One-time-only event with custom parameters:
Event e = new Event("test-event", true);
e.AddPair("my-custom-param", "hello world");
Tapstream.FireEvent(e);

Note: Custom event parameters are not exposed in Tapstream's dashboard. The key/value pairs are exposed via Tapstream's postback system and Conversion API. Custom parameters are usually used for integration with a third-party ad network or your in-house dashboard or CRM.

Changing the default behavior of the Tapstream SDK

Note: Changing this behavior is not usually required.

To change the default Tapstream config, provide config overrides like this:

Config conf = new Config();
conf.Set("idfa", "<IDFA goes here>");
conf.Set("collectWifiMac", false);
conf.Set("collectDeviceId", true);
conf.Set("installEventName", "custom-install-event-name");
Tapstream.Create("TAPSTREAM_ACCOUNT_NAME", "TAPSTREAM_SDK_SECRET", conf);

Consult the platform-specific SDK documentation to see what config variables are available on each platform.