Analytics

Custom event

Pre API 2.0

// Without properties
Analytics.TrackCustomEvent("sample_event");

// With properties
Dictionary<String, String> properties = new Dictionary<String, String>()
{
	{ "keyTrackEvent","valueTrackEvent" },
};
Analytics.trackCustomEvent("sample_event", eventProperties: properties);

API 2.0

JSONObject, Bundle, etc. are no longer supported and Properties are used.

// Without properties
Smartlook.Instance.TrackEvent("sample_event");

// With properties
Dictionary<String, String> properties = new Dictionary<String, String>()
{
	{ "keyTrackEvent","valueTrackEvent" },
};
Smartlook.Instance.TrackEvent("sample_event", properties);

🚧

Event name restrictions

  • Cannot be empty or null.
  • The maximum length is 200 characters.
  • Contains only alphanumeric characters and β€œ_”, " ", β€œ.”, β€œ-”.
  • Must start with an alphabetic character.

An event with an incorrect name will be dropped.

Track event documentation.
Properties documentation.

Navigation event

Pre API 2.0

Analytics.TrackNavigationEvent("SampleScreen",type: NavigationEventType.Enter);
Analytics.TrackNavigationEvent("SampleScreen",type: NavigationEventType.Exit);

API 2.0

ViewState and ViewType are no longer part of the API:

  • ViewState is not needed because there 2 methods enter and exit.
  • ViewType navigation events do not have any types and it's universal for all cases (Activity, Fragment, "custom").
Smartlook.Instance.TrackNavigationEnter("SampleScreen");
Smartlook.Instance.TrackNavigationExit("SampleScreen");

🚧

Navigation event name restrictions

  • Cannot be empty or null.
  • The maximum length is 200 characters.
  • Contains only alphanumeric characters and β€œ_”, " ", β€œ.”, β€œ-”.
  • Must start with an alphabetic character.

An event with an incorrect name will be dropped.

Track navigation event documentation.

Global event properties

Pre API 2.0

Analytics.SetGlobalEventPropertiy("name","value");

API 2.0

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

🚧

Properties mutability

All event properties are now mutable. If immutability of certain properties is needed it must be ensured on the client-side.

Event properties documentation.
Properties documentation.