The previous version of the documentation for the implementation of digitalData is available here: digitaldata.readme.io
One can imagine that the object is a cabinet with drawers signed with unique names. In each drawer there can be documents, also having their names. Access to information is carried out by the path to the document that lies in the drawer (‘Cabinet name’. ‘Drawer name’. ‘Document name’).
SegmentStream - is a program that can work with the
digitalData object, implemented in accordance with the standard. SegmentStream automatically finds the necessary documents in the required drawers, collects them together and centrally sends them to other document stores - third-party marketing and analytics systems.
digitalData - is the standard developed by the SegmentStream project team.
When everything is filled in accordance with the standard, you can, for example, easily recognize the type of page you are currently on. Just refer to the object
type- Document. The document will have “home” written in it if you are on the main page, “product” - on the product page, “cart” - in the basket, etc. Since any value can be written to a document, it is called a variable. Below we will talk about how to correctly fill each variable of the object
digitalDatafor each page and every event that occurs on the site.
As it was noted above, the whole system is controlled by the program (library, script) SegmentStream. It is important to initialize the library in the correct place of the source code of your site. SegmentStream should be called on every page of the site.
There is one drawer in the
digitalData cabinet, which is called events.
digitalData.events is an array, it can contain the same objects - events. Access to each event is carried out by the sequence number of its addition to the drawer, for example
digitalData.events. The event itself is an object that contains information about what happened.
For example, when a page of a site is loaded, the
Viewed Page event occurs. It is the very first event added to the array
SegmentStream watches the array
digitalData.events all the time. As soon as an event arrives in the array, SegmentStream enriches it with information from other object variables and sends it to connected marketing and analytics systems.
Another drawer is called changes.
digitalData.changes is an array that contains information about all the changes that occurred with variables in digitalData without a page reload.
For example: the composition of the basket has changed, a filter of goods in the catalog has been applied, the user has changed the delivery method and others.
All these changes must be made using the changes method.
Although it is physically possible, do not modify the digitalData object without using the digitalData.changes  method
SegmentStream is able to monitor user’s interactions with website content. When certain site elements appear the user’s field of view or when he clicks on links and active elements, SegmentStream automatically adds events to the array
For everything to work correctly, you need to add special classes and data-attributes to the tracked elements.