Property groups in Avo Codegen

2 minute read

In Avo you can group multiple event properties that are commonly used together into a property group.

Property groups allow you to increase the consistency of your tracking plan as well as increasing efficiency when defining new events and implementing them.

Example

In Avo we have a property group called "Source", that includes 2 properties: "Source Id" and "Source Name".

We add this property group to any event that is related to a source instead of adding those 2 properties manually every time.

Property groups can include more than 2 properties, there is no upper limit.

Read more about property groups here.

Property groups in Avo Codegen

When generating code for a tracking plan with property groups the property groups can be in 2 states:

  • Folded: in this case we can represent a property group as an object in the code. Every property included into the property group becomes a field of the object.

  • Unfolded: in this case all the properties from the property group are added to the event tracking function as if the properties were added directly to the event in Avo.

Folded property groups are currently supported in 4 languages: Kotlin, Swift, Objective-C and Rescript/ReasonML. Codegen for these languages will generate group properties in the folded state by default, unless force unfolding happens. Contact us if you want to force unfold all property groups in your workspace.

Force property group unfolding

Sometimes a change in the tracking plan can cause a property group to be force unfolded.

This happens if the property group data structure can not be represented as a specific type in the programming language anymore.

One reason for that is when the property absence varies between different events.

In that case a property can be optional on one event and required on another event.

This circumstance makes it impossible to represent this property group type as a class in the code, because one filed of that class should be optional under one condition and non optional under another.

When this happen we unfold the property group, so each event can get granular property presence.