Analytics

Custom event

Pre API 2.0

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

// With properties
Smartlook.trackCustomEvent("sample_event", eventProperties: : Dictionary<string> = {});

Smartlook.trackCustomEvent("sample_event", "key", "value");

API 2.0

JSONObject, Bundle, etc. are no longer supported and props as plain objects are used.

// Without properties
Smartlook.trackEvent({ eventName: "sample-event" });

// With properties

const props = {
  "sample-key": "sample-value"
};

Smartlook.trackEvent({ eventName: "sample-event", props });

🚧

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: Smartlook.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 on both iOS and Android.
Smartlook.trackNavigationEnter({ eventName: "SampleScreen", props? });
Smartlook.trackNavigationExit({ eventName: "SampleScreen", props? });

🚧

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(properties: {}, immutable: boolean);
Smartlook.setGlobalEventProperty(key: string, value: string, immutable: boolean);

API 2.0

Smartlook.putGlobalEventProperty({ propertyName: "sample-name", propertyValue: "sample-value" });

Smartlook.removeEventProperty({ propertyName: "sample-name" });

Smartlook.getGlobalEventProperty({ propertyName: "sample-name" }, successCallback);

function successCallback(propertyValue: string){
  console.log('Property value:' + propertyValue)
};

🚧

Properties mutability

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