For special circumstances, you can provide your own function that will be called for all data layer events. This provides a hook for modifying a data layer event before it is pushed into the data layer. This use case isn’t primarily applicable to headless sites since the developers implement their own custom data layer, but it can be used to customize the enriched data for each data layer event.

window.ElevarTransformFn = item => {
	if (item.event === "dl_add_to_cart") {
		return {...item, custom_property: "my_custom_property"};
	} else {
		return item;
	}
};

When any data layer event is pushed, this custom_property will be used.

console.log(dataLayer[dataLayer.length-1].custom_property);
// logs my_custom_property