data layer - measurecamp vii 2015

28
@SimoAhava

Upload: simo-ahava

Post on 21-Jan-2017

2.808 views

Category:

Internet


1 download

TRANSCRIPT

@SimoAhava

The Data Layer MeasureCamp @SimoAhava

Typically, there are three definitions

of Data Layer that we use in the digital world. @SimoAhava from @ReaktorNow at #MeasureCamp

1. Set of business requirementsfor 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

Across all three definitions, the purpose of a Data Layer

is simple:

@SimoAhava from @ReaktorNow at #MeasureCamp

@SimoAhava from @ReaktorNow at #MeasureCamp

DMP / DWH / TMS / etc.

X X

Actions Presentation

Data Layer

@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.

As a set of business requirements, the Data

Layer is a living document.

@SimoAhava from @ReaktorNow at #MeasureCamp

- 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

As a global data structure, the Data Layer is a

repository of information.

@SimoAhava from @ReaktorNow at #MeasureCamp

GTM’s dataLayer is an Array-type structure, which has a proprietary .push() method

@SimoAhava from @ReaktorNow at #MeasureCamp

Interaction is done most commonly by pushing an {object literal}, which has keys and values of any JavaScript type.

@SimoAhava from @ReaktorNow at #MeasureCamp

The only method that works with GTM is push. No other Array methods have an impact.

@SimoAhava from @ReaktorNow at #MeasureCamp

As an internal data model, the platform utilizes data in

the global dataLayer.

@SimoAhava from @ReaktorNow at #MeasureCamp

When you push a key into dataLayer, it gets copied into the internal data model.

@SimoAhava from @ReaktorNow at #MeasureCamp

When the value is an object, a recursive merge takes place.

@SimoAhava from @ReaktorNow at #MeasureCamp

The data model has some special methods as well.

@SimoAhava from @ReaktorNow at #MeasureCamp

Key learnings about how the Data Layer should could

be used:

@SimoAhava from @ReaktorNow at #MeasureCamp

Pre-container-snippet-dataLayer is available to Tags firing with "All Pages" or "Page View" Triggers.

@SimoAhava from @ReaktorNow at #MeasureCamp

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

Never use var dataLayer = []; as you can unwittingly destroy your GTM implementation.

@SimoAhava from @ReaktorNow at #MeasureCamp

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

Values in the data model can be accessed with the Data Layer Variable.

@SimoAhava from @ReaktorNow at #MeasureCamp

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

Square bracket notation does not work, replace with special dot notation to access Array members (Version 2 only).

@SimoAhava from @ReaktorNow at #MeasureCamp

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

The Data Layer: http://goo.gl/9r4Ndw

Google Tag Manager’s Data Model: http://goo.gl/WhvSI9

@SimoAhava from @ReaktorNow at #MeasureCamp

FURTHER READING

@SimoAhava @ReaktorNow

THANK YOU