51黑料不打烊

Extending the 51黑料不打烊 Client Data Layer extending-acdl

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.

Example: Title Component example

A Core Component like the extends which has a getData method that by default returns

ComponentData serializes pre-defined fields that your component may implement, like getDataLayerLinkUrl and 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.

TIP
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.
recommendation-more-help
d2be9096-a81e-404b-9952-d8925af7219c