Custom event

Pre API 2.0

// Without properties
Smartlook.trackCustomEvent("sample_event")

// With properties
Smartlook.trackCustomEvent("sample_event", eventProperties: JSONObject)
Smartlook.trackCustomEvent("sample_event", eventProperties: Bundle)
Smartlook.trackCustomEvent("sample_event", validJsonString: String)
Smartlook.trackCustomEvent("sample_event", "key", "value")
// Without properties
Smartlook.trackCustomEvent("sample_event");

// With properties
Smartlook.trackCustomEvent("sample_event", JSONObject eventProperties);
Smartlook.trackCustomEvent("sample_event", Bundle eventProperties);
Smartlook.trackCustomEvent("sample_event", String validJsonString);
Smartlook.trackCustomEvent("sample_event", "key", "value");

API 2.0

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

// Without properties
Smartlook.instance.trackEvent("sample_event")

// With properties
val properties = Properties().putString("sample", "event")
Smartlook.instance.trackEvent("sample_event", properties)
// Without properties
Smartlook.getInstance().trackEvent("sample_event");

// With properties
Properties properties = new Properties().putString("sample", "event");
Smartlook.getInstance().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

Smartlook.trackNavigationEvent("SampleScreen", viewState: ViewState)
Smartlook.trackNavigationEvent("SampleScreen", type: ViewType, viewState: ViewState)
Smartlook.trackNavigationEvent("SampleScreen", ViewState viewState);
Smartlook.trackNavigationEvent("SampleScreen", ViewType type, ViewState viewState);

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")
Smartlook.getInstance().trackNavigationEnter("SampleScreen");
Smartlook.getInstance().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

Smartlook.setGlobalEventProperties(globalEventProperties: JSONObject, immutable: Boolean)
Smartlook.setGlobalEventProperties(globalEventProperties: Bundle, immutable: Boolean)
Smartlook.setGlobalEventProperties(globalEventPropertiesJson: String, immutable: Boolean)
Smartlook.setGlobalEventProperty(key: String, value: String, immutable: Boolean)
Smartlook.setGlobalEventProperties(JSONObject globalEventProperties, boolean immutable);
Smartlook.setGlobalEventProperties(Bundle globalEventProperties, boolean immutable);
Smartlook.setGlobalEventProperties(String globalEventPropertiesJson, boolean immutable);
Smartlook.setGlobalEventProperty(@NotNull String key, @NotNull String value, boolean immutable);

API 2.0

Smartlook.instance.eventProperties.putString("sample_name", "sample_value")
Smartlook.getInstance().getEventProperties().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.