Slides from my talk at MeasureCamp VII (London) in September 2015. Some key findings about Data Layers and how they are integrated with tag management solutions and organisations.
3. Typically, there are three
definitions
of Data Layer that we use in
the digital world.
@SimoAhava from @ReaktorNow at #MeasureCamp
4. 1. Set of business
requirements
for tracking
digital assets,
visits, and
visitors.
2. Encoded, global
data structure,
accessed and
modified by
connected
platforms.
2. Data model of a
connected
platform, which
copies or digests
information in the
global structure.
dataLayer.push({
'pageType' : 'home'
});
google_tag_manager['GTM-123']
.dataLayer
.set('pageType', 'home');
@SimoAhava from @ReaktorNow at #MeasureCamp
5. Across all three definitions,
the purpose of a Data Layer
is simple:
@SimoAhava from @ReaktorNow at #MeasureCamp
7. @SimoAhava from @ReaktorNow at #MeasureCamp
DMP / DWH / TMS / etc.
X X
Actions Presentation
Data Layer
The purpose of a Data Layer is to provide a bilateral layer on the digital
asset, which decouples, normalises, and uniformly encodes semantic
information passed through and stored within.
8. As a set of business
requirements, the Data
Layer is a living document.
@SimoAhava from @ReaktorNow at #MeasureCamp
9. - Can be encoded into a spreadsheet, a text document, or even simply as an interface design
of the front-end
- Important thing is to identify the variables in the Data Layer, with context and ownership
explicitly stated — each variable needs to have business impact / tie-in
- It’s a living document, so it should be kept up-to-date when changes to the dataLayer are
implemented
- Usually the document only reflects variables that are produced server-side (upon page
render)
@SimoAhava from @ReaktorNow at #MeasureCamp
10. As a global data structure,
the Data Layer is a
repository of information.
@SimoAhava from @ReaktorNow at #MeasureCamp
11. GTM’s dataLayer is an Array-type structure, which has a proprietary .push() method
@SimoAhava from @ReaktorNow at #MeasureCamp
12. Interaction is done most commonly by pushing an {object literal}, which has keys and values
of any JavaScript type.
@SimoAhava from @ReaktorNow at #MeasureCamp
13. The only method that works with GTM is push. No other Array methods have an impact.
@SimoAhava from @ReaktorNow at #MeasureCamp
14. As an internal data model,
the platform utilizes data in
the global dataLayer.
@SimoAhava from @ReaktorNow at #MeasureCamp
15. When you push a key into dataLayer, it gets copied into the internal data model.
@SimoAhava from @ReaktorNow at #MeasureCamp
16. When the value is an object, a recursive merge takes place.
@SimoAhava from @ReaktorNow at #MeasureCamp
17. The data model has some special methods as well.
@SimoAhava from @ReaktorNow at #MeasureCamp
18. Key learnings about how
the Data Layer should could
be used:
@SimoAhava from @ReaktorNow at #MeasureCamp
20. Still, it’s a good idea to always have the 'event' key in the push, so that you can always use a
Custom Event Trigger as well.
@SimoAhava from @ReaktorNow at #MeasureCamp
21. Never use var dataLayer = []; as you can unwittingly destroy your GTM implementation.
@SimoAhava from @ReaktorNow at #MeasureCamp
22. eventCallback can be used to execute a function after the event has completed (i.e. all
dependent Tags have fired).
@SimoAhava from @ReaktorNow at #MeasureCamp
23. Values in the data model can be accessed with the Data Layer Variable.
@SimoAhava from @ReaktorNow at #MeasureCamp
24. Version 2:
- Dots can be used to access nested key names, and/or JavaScript properties:
—— someKey.nestedKey
—— someKey.parentElement.href
- Understands recursive merge, i.e. returns the full, merged object
Version 1:
- Dots have no function, i.e. they are interpreted as being part of the key name
- Does not understand recursive merge, so only returns the value that was most recently
pushed into this key
@SimoAhava from @ReaktorNow at #MeasureCamp
25. Square bracket notation does not work, replace with special dot notation to access Array
members (Version 2 only).
@SimoAhava from @ReaktorNow at #MeasureCamp
26. Values in the data model persist for the duration of the event. You can’t update values during
an event with dataLayer.push().
@SimoAhava from @ReaktorNow at #MeasureCamp
27. The Data Layer: http://goo.gl/9r4Ndw
Google Tag Manager’s Data Model: http://goo.gl/WhvSI9
@SimoAhava from @ReaktorNow at #MeasureCamp
FURTHER READING