Analytics

Smartlook automatically tracks a number of events in user sessions. To read more what is automatically tracked, see Event Tracking. You can also create custom events to track events that are not automatically tracked.

🚧

Events can be tracked only when the SDK is running.

Tracking a custom event

You can track a custom event:

Smartlook.Instance.TrackEvent("sample_event");

🚧

Event name restrictions

  • Cannot be empty or null
  • Maximum length is PROPERTY_NAME_MAX_LENGTH
  • Contains only alphanumeric characters, underscore (_), comma (,), period (.), and hyphen (-)
  • Must start with an alphabetic character

An event with an incorrect name will be dropped.

You can add additional data to the event as a properties object:

Dictionary<String, String> properties = new Dictionary<String, String>(){};
properties.Add("key", "value");
Smartlook.Instance.TrackEvent("name", properties: properties);

📘

Properties API

Full documentation on using the put, get, and remove properties can be found in the properties section.

Navigation event

To manually track screen and navigation transitions:

Smartlook.Instance.TrackNavigationEnter("SampleScreen");
Smartlook.Instance.TrackNavigationExit("SampleScreen");

🚧

Navigation event name restrictions

  • Cannot be empty or null
  • Maximum length is PROPERTY_NAME_MAX_LENGTH
  • Contains only alphanumeric characters, underscore (_), comma (,), period (.), and hyphen (-)
  • Must start with an alphabetic character

A navigation event with an incorrect name will be dropped.

You can add additional data to the navigation event as a properties object:

Dictionary<String, String> enterProperties = new Dictionary<String, String>()
{
	{ "keyTrackEvent","valueTrackEvent" },
};
Smartlook.Instance.TrackNavigationEnter("SampleScreen", enterProperties);
  
Dictionary<String, String> exitProperties = new Dictionary<String, String>()
{
	{ "keyTrackEvent","valueTrackEvent" },
};
Smartlook.Instance.TrackNavigationExit("SampleScreen", exitProperties);

📘

Properties API

Full documentation on using the put, get and remove properties can be found in the properties section.

Event properties

You can merge additional properties in every event properties:

Smartlook.Instance.eventProperties.PutString("sample_name", "sample_value");

🚧

Override priority

Properties set in eventProperties have a lower priority than properties defined in one of the track() calls. This means that if there are properties with the same name in both, the value stored in eventProperties will be kept.

📘

Properties API

Full documentation on using the put, get and remove properties can be found in the properties section.

Automatic event tracking

You can enable or disable automatically tracked event using the Tracking API. For more information on the Tracking API, see Preferences & State documentation.