Starting from Analytics collector v3 for Android and iOS it is possible to setup custom data values in two different ways:
Setting source independent custom data through `
DefaultMetadata
` when creating the collector. These values are static and cannot be changed after creating the collector. A typical usecase for source independent custom data is the app version, or a more specific device type or platform than the one collected automatically.Setting custom data through `
SourceMetadata
` for a specific source. If some source has custom data values setup as `SourceMetadata
` those values will be used when the player is playing the source. If some custom Data fields are `null
` in the SourceMetadata, the respective fields in `DefaultMetadata
` are used. So merging is done on a field basis (customData1, customData2, ...) with `SourceMetadata
` taking higher priority than `DefaultMetadata
`.
### Changing Custom Data
Custom data of the `SourceMetadata
` can be changed by calling `setCustomData
` with the source for which custom data should be changed as first parameter. These changes have the same lifecycle as the `SourceMetadata
` of the source. (`setCustomData
` is just an accessor to the `customData
` inside `SourceMetadata
`)
When custom data is changed through `setCustomData
`, the current measurement (or sample) is closed with the old custom data, and all subsequent samples of the current impression will use the new custom data.
It is also possible to directly change the custom data values in `SourceMetadata
` by resetting the `SourceMetadata
` while playing, but in this case, no additional samples will be sent, and the new values are picked up with the next events.