Get content/entity/user data from inside Drupal to the client-side/front-end.

Outputs various CMS page meta data (like content type, author uid, taxonomy terms), which can be used for all kinds of front-end features. This works for all entity types and is easy to extend with hooks.

D7: Use the 7.x-1.x-dev version.

Documentation on GitHub

Often used for Google Tag Manager.

The "dataLayer" is just a front-end standard for passing info around, for example allowing your server-side to inform javascript behaviors. It enables plenty of 3rd party services (like Google Tag Manager) to access web application data. Regardless, you should use this juicy data to implement super-awesome-great client-side features, like... anonymous user tracking, etc.

NOTE: The dataLayer object is used as a warehouse for Google Analytics and GTM, and is therefor an array of objects. To safely access properties you should use the data-layer-helper library, a dependency of this module.

Some of what's exposed by default...

  "drupalLanguage": "en",
  "userUid": "555",
  "entityId" : "123",
  "entityLabel" : "My Cool Page",
  "entityType" : "node",
  "entityBundle" : "article",
  "entityUid" : "555",
  "entityTaxonomy" : {
    "my_vocab" : {
      "25" : "Term Name",
      "26" : "Another Term"


var myHelper = new DataLayerHelper(dataLayer);

Add properties:

As easy as (other methods available: datalayer.api.php)...

  'myProperty' => $value


Provides front-end access to full-detail i18n language configurations, and a simple prefix list...


You'll need the Data Layer Helper library to manually access content client-side. Place that within your Libraries.

Need to create a custom dimension in GA via GTM from taxonomy terms? Output is an object so you'll need this little code snippet.


This module was created to work with Semi Anonymous, but is more widely useful.

Supporting organizations: 

Project information