You can create properties
objects to add additional information to events. You can then use this extra information to further break down the event.
Create Properties
To create Properties
for event and user properties, use the default constructor:
const properties = new Properties();
Put property
You can add properties using the putString()
method. Every property is defined by a name
and value
.
properties.putString("sample-name", "sample-value")
Name restrictions
- Cannot be empty or null.
- Maximum length is 200 characters.
- Can only contain alphanumeric characters, underscore (_), comma (,), period (.), and hyphen (-).
- Must start with an alphabetic character.
Value restrictions
- The maximum length is 5 kilobytes.
Get property
You can read any property using getString()
. If a property with the name
exists, the the value
is returned. Otherwise, undefined
is returned.
const sampleValue = properties.getString("sample-name");
Remove property
You can remove any property using remove()
.
properties.remove("sample-name");
Clear properties
You can clear all properties using clear()
:
properties.clear();