Building blocks
Attributes
Attributes are contextual data about the environment your application runs in.
Examples#
If you are building a web or mobile application, examples of attributes can be:
deviceId
userId
country
browser
os
- ...etc
Defining attributes#
If we choose to define a new attribute called deviceId
, we can create a new file called deviceId.yml
in the attributes
directory:
description: Device IDtags: - webtype: string
The file name (without the extension) will be the name of the attribute.
Description#
The description
property is purely for documentation purposes:
# ...description: Device ID
Tags#
Tags are used to generate targeted datafiles for your applications:
# ...tags: - web - mobile - backend
Types#
Based on [JSON Schema], we can chose from several different types for an attribute:
string
number
(integer or float)integer
(whole number only)boolean
object
array
string#
description: My attributetags: - webtype: string
number#
description: My attributetags: - webtype: number
integer#
description: My attributetags: - webtype: integer
boolean#
description: My attributetags: - webtype: boolean
object#
description: My attributetags: - webtype: objectproperties: name: type: string version: type: semverrequired: - name
array#
description: My attributetags: - webtype: arrayitems: type: string
Setting attribute values#
In your application, you will be setting the attribute values using provided SDKs.
If we take JavaScript SDK as an example, we can set the attribute values like this:
eventvisor.setAttribute("myAttribute", "value");
If the value is not matching the schema, we will get a validation error in the console.
Deprecating#
You can deprecate an attribute by adding deprecated: true
to the attribute definition:
# ...deprecated: true
If deprecated, it will still continue to work as expected, but the SDKs will show a warning in the console notifying the developers to take action.
Archiving#
You can archive an attribute by adding archived: true
to the attribute definition:
# ...archived: true