You can extend the Core Components with custom dialog options that allow content authors to enter additional information related to the Data Layer.
To include these fields in the Data Layer that is provided by the Core Components, you must extend the model of the component that implements its own specific data layer methods.
ComponentData serializes pre-defined fields that your component may implement, like
getDataLayerTitle for the
Therefore, your custom Sling model might have a
getData method that returns an object that extends
ComponentData to return more fields.
Doing this, will add a
data-cmp-data-layer attribute to the HTML element of your component with the JSON of the data that will be populated to the data layer. At this point, you can implement scripts that listen to this data or to related events.
To further explore the flexibility of the Data Layer, review about the integration options including how to enable the Data Layer for your custom components.