Skip to content

Property Schema ​

Properties are attributes that can be attached to events or groups. They provide additional context about the action or entity being tracked.

Configuration ​

FieldTypeRequiredDescription
namestringyesProperty name
descriptionstringnoProperty context description
typestring, string[], boolean, Boolean[], number, number[], oneOfyesExpected TypeScript type
defaultValueanynoDefault value to use if one is not provided
optionalbooleannoMark property as optional

Type Options ​

Properties support various type configurations:

  • Simple Types: string, number, boolean
  • Array Types: string[], number[], boolean[]
  • Enum Types: ["value1", "value2"]

Note: Properties can be a function, promise, or a function returning a promise. Function properties are re-evaluated for every tracked event, which is useful for auto-tracking dynamic values like the current page url.

typescript
tracker.setProperties('EveryEvent', {
  // Functions are re-evaluated for each tracked event
  Url: () => window.location.href,
});

Example ​

yaml
properties:
  - name: Page Name
    description: The name of the page that was viewed.
    type: string

  - name: User Role
    description: The role of the user.
    type: [admin, member, guest]

  - name: View Count
    description: Number of times the item was viewed.
    type: number
    optional: true