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:
deviceIduserIdcountrybrowseros- ...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: stringThe file name (without the extension) will be the name of the attribute.
Description#
The description property is purely for documentation purposes:
# ...description: Device IDTags#
Tags are used to generate targeted datafiles for your applications:
# ...tags: - web - mobile - backendTypes#
Based on [JSON Schema], we can chose from several different types for an attribute:
stringnumber(integer or float)integer(whole number only)booleanobjectarray
string#
description: My attributetags: - webtype: stringnumber#
description: My attributetags: - webtype: numberinteger#
description: My attributetags: - webtype: integerboolean#
description: My attributetags: - webtype: booleanobject#
description: My attributetags: - webtype: objectproperties: name: type: string version: type: semverrequired: - namearray#
description: My attributetags: - webtype: arrayitems: type: stringSetting 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: trueIf 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
