Closed SachaMorard closed 1 month ago
@SachaMorard a couple of doubts:
data_collection.events[].context
? If something is relevant only for a specific event, then it should probably be used inside its data
field, right? I cannot think of a case where we need single-event contextuser
event, then is that also used as context for the other events, as if it was defined in data_collection.context.user
? In other words, when should a customer trigger a user event vs using the user context?@alexcasalboni my answers bellow:
- what is the purpose of
data_collection.events[].context
? If something is relevant only for a specific event, then it should probably be used inside itsdata
field, right? I cannot think of a case where we need single-event context
You're right, I don't see a case where it would be useful. But backstage, we need to copy this context into each event to facilitate the event processing. So it's here, accessible, but not useful for the developer. You can easily leave this out of the documentation.
- If I define a
user
event, then is that also used as context for the other events, as if it was defined indata_collection.context.user
? In other words, when should a customer trigger a user event vs using the user context?
No, it is not.
A developer has to declare a user
type event when he wants to launch a dedicated user event, to store something special about the user (a name change for example).
The context.user
has to be used when a developer wants to attach any other event to a user. Normally, analytics technologies can assign all events to a user, as long as a “user” event is launched at some point.
I would suggest we define some kind of official JSON Schema for the new Data Layer.
This would allow us to validate schemas automatically and even provide customers with a schema validator (like somewhere in the docs).
Here's an example:
And a browser-based validator: https://www.jsonschemavalidator.net/s/EplejUWa
Also, I know we're rushing a bit, but this would be a great opportunity to add a few unit tests to make sure the parsing/validating/merging is working as expected, and that we're correctly handling what should happen in case of invalid JSON structures, etc. 😄
Checklist
Description of Changes
Preparing
edgee
v0.4.0__EDGEE_CONTEXT__
script tag becomes__EDGEE_DATA_LAYER__
to evolve towards standard naming. At the same time, the interface has changed radically to give developers greater control over what is captured by the edge.Here is an example of a full and complex data layer:
In the data layer, a first
data_collection
node is available:data_collection.context
is useful if the developer wants to declare general information on the pagedata_collection.components
allows the developer to enable/disable components for the current pagedata_collection.events
is an array. It allows the developer to declare the events Edgee has to fire edge-side (or client-side if the edge collection is not possible). In that way, developers can take full control of the page event, and/or launch multiple page events per page… and/or a track event… For example, a developer can disable a page event, but launch a track event only for amplitude.Each event can have the following fields:
page
,track
, oruser
If the
data_collection.context
is set, Edgee will use it to gather theevent.data
andevent.context
fields. Ifdata_collection.components
is set, Edgee will use it to gatherevent.components
field.IMPORTANT OTHER CHANGES:
destinations
becomescomponents
identify
event becomesuser
Related Issues
No issue