Note: This developer site is moving to and will be redirected by September 30, 2021


This document contains reference material for Google Tag Manager.

API Reference


The dataLayer is a global object of key/value pairs passed to Google Tag Manager. It can be used to describe information that isn't available as part of a page DOM or other JavaScript variables. The dataLayer object needs to be initialized.


  dataLayer = [{
    'pageCategory': 'signup',
    'visitorType': 'high-value'


A method to update the data layer with new or updated key/value pairs.


    dataLayer.push({'pageCategory': 'updated value'});

Ecommerce Data Layer Variable Names

You must use required Ecommerce data layer variable names in order to use Google Analytics or Universal Analytics transaction tags. Not using these variable names can result in lost or incomplete Ecommerce data in your Google Analytics reports.

Social Data Layer Variable Names

The following variable names are required if you are using Google Analytics social tracking tags and have checked the Use Data Layer option in the tag edit view:

Data Layer Variable Name Description
network Required. A string representing the social network being tracked (e.g. Facebook, Twitter, LinkedIn)
socialAction Required. A string representing the social action being tracked (e.g. Like, Share, Tweet)
opt_target Optional. A string representing the URL (or resource) which receives the action.
opt_pagePath Optional. A string representing the page by path (including parameters) from which the action occurred.

Learn more about social interaction tracking.