Skip to main content

Data Layer


Data Layer

Zephr has the ability to integrate with your analytics platform and third party systems by writing user information to a data layer.

A data layer is a JSON data object found within a user’s browser for integration with third-party systems such as Google Analytics and Adobe Analytics. By writing to a user’s data layer, Zephr is able to share vital behavioural, journey and usage information. The data layer is user and browser-specific and is written to with each page view. This is known as a data layer push.

A data layer is made up of a list of key/value pairs. A key is a category of things – for example, the user attribute ‘City’. Each key can have different values – so a user may have a key/value pair of City: London, or of City: New York, depending on the details they have provided. Likewise, when using a Zephr meter count as a key, you will see varying values for each user.

Why use Zephr Data Layer?

The Zephr Data Layer is incredibly helpful for recording and analysing core user behaviour and consumption patterns. Some examples of how our clients are using our Data Layer feature include:

  • Monitoring remaining trial values to examine how free trials are being consumed
  • Using Test Group analytics to monitor results of bucket testing within Zephr Rules
  • Monitoring the number of active sessions to track fair use of subscriptions

Configuring your Data Layer with Zephr

To configure your data layer with Zephr, navigate to Settings > Data Layer within your Zephr Admin Console.

Within this page, you will see two sections. The first section, Configuration, is where you name your data layer. By default, this is set to dataLayer – the name commonly used with Google Analytics. Choose the Enabled setting to turn your data layer configuration on. This calls the Zephr data layer endpoint and pushes the information to window.dataLayer for a tag manager to pick up.

The second section is Fields. In this section you will configure the information you wish Zephr to write to the data layer, to be ingested by your analytics platform.

To add a variable, click Add Field then choose the variable you would like written from the Selector Type field. Selector Types include:

User Schema

Choose a specific attribute from your Zephr User Schema. The data layer will populate the value as the information stored against that user. For example, choosing First Name as your user attribute could write to the data layer as first-name: Gwen.


Choose to write data on the following activities:

  • loggedIn: delivers a true/false on whether the user is logged in at the time of the data layer being written
  • activeSessions: states the number of active sessions the user currently has
  • trackingId: writes the user’s Zephr Tracking ID to the data layer

Active Products

Writes data on a user’s active product grants.

Test Group

Choose a specific Test Group per field, with the data layer specifying whether the user falls into Group A or Group B.

Following your field selection, you will need to enter a Label and a Key for the Selector Type you have chosen. Your label is for internal use, whilst your Key will be used by the system that is reading the data layer – for example, Google Analytics. As such, these keys will also need to be set up as variables within your analytics platform. Consult the help section of your analytics platform for more information.

Once you have added your full list of data layer fields, click Save. Following this, the fields you have specified will be written to a user’s data layer with every page load, provided you have set the Data Layer configuration to Enabled.