I would like to automatically provide some data element without need for the user to create data elements for each possible items in each Launch properties.
My example is to be able to set Adobe Analytics settings as:
channel: "%digitalData.page.category.primaryCategory%"
propX: "%digitalData.page.attributes.marketID%"
propY: "%digitalData.user.0.segment.subscriptionOffer%"
prop2: "%window.location.href%"
For now, I use my extension main module:
_satellite.setVar({
window: window,
digitalData: window.digitalData
});
Problems
Token resolution in hydration phase
The Adobe Analytics (get-tracker) extension main module when get hydrated, synchronously read its settings (via getExtensionSettings()
) that force to resolve all tokens in that settings, even before any other extensions had the opportunity to declare custom variables.
Some times it's works because the extension list is in an order where AA is after the one that call _satellite.setVar()
. But it's not always the case. This order could change after a new library version is published.
There is not reliable way to provide custom vars (in extensions settings).
About the main module that couldn't be executed in reliable order:
main
(optional)
[...]
This module will always be included in the runtime library and executed. Because the module is always included in the runtime library, we recommend only using a βmainβ module when absolutely necessary and keeping its code size minimal.
This module is not guaranteed to be executed first; other modules may be executed before it.
β Extension Manifest | Adobe Experience Platform
Non-browsable data elements
Data elements aren't browsable because it could break backward compatibility:
|
// Accessing nested properties of a data element using dot-notation is unsupported because |
|
// users can currently create data elements with periods in the name. |
So you need to declare one data element per fields that exist in the datalayer, which generate a library that is quite heavy (with all generated code {modulePath:"path/to/module.js",settings:{...
per datalayer fields). And it's more difficult to maintains, especially when the same configuration is used by multiple properties.
Possible solutions
The following is what I think as possible solutions.
Add a way for extensions to wait all modules to be hydrated
With an API, it could be possible to execute something only after all modules has been hydrated. Like wait a promise turbine.hydration
that resolve after hydration phase?
A simplier solution without a dedicated API, is to wait the next macrotask with setTimeout(() => turbine.getExtensionSettings())
?
Something that the Adobe Analytics extension (and others) could use to wait other extension to provide custom vars?
Add a ways to declare custom vars via the manifest
But I'm not sure if that solve problems. Because you will need a module to provide values? What happens if the module call turbine.getExtensionSettings()
, which need to resolve tokens? It's a vicious circle (like we call it in french: "C'est le serpent qui se mord la queue")
Browsable data element
Add an option (in the manifest or in the data element's attributes) that allow data element to be "browsable" with tokens, like custom vars, event
, target
and this
.
Why declare hundred of data elements in your property, when you need only one (like arrays myarray.0
)?
Allow Launch users to define extensions hydration order
Actually I'm not sure how extensions are ordered in the library package. It looks like it's based on the revision date and/or in the library's resources list order. But I'm not sure this is a good idea, because unless you exactly what the extension do, it's will be hard to set the right values.
Centralized rules/data elements
Some way to reduce the number of data elements to maintain cross multiple properties, especially when there is lot of Tags resources. The thing is to have a library property that can be used as a "base" by an other property (kind of "extends").
See the AEPL ideas:
And has been mentioned in a comment about having the ability to copy resources into other properties:
[...] totally recognize the need for a central place to modify rule components and data elements that can be used by multiple properties and managed in one place.
β @thebenrob Copy/Replicate Adobe Launch Properties (Templates)