How to Call Google Analytics Objects in DTM using Scripts

DTM Google Analytics Classic

When you set up a Google Analytics Classic tool, you can choose between using GA Default Name, DTM Generated Name, or Specific Name.

GA Default Name

When using the GA default name, then you can use Google Analytics as follows in script.

Without trackerName as variable

_gaq._getAsyncTracker()._trackPageview();

With trackerName:

tracker = _gaq._getAsyncTracker();
tracker._trackPageview()

DTM Generated Name

When using the GA DTM generated name, you can use Google analytics as follows in script.

Get the tracker name in DTM Google analytics classic interface:

Without trackerName variable:

_gaq._getAsyncTracker("ddf16922edc9c2318ea19ad8369fcc92")._trackPageview();

With trackerName:

tracker = _gaq._getAsyncTracker("ddf16922edc9c2318ea19ad8369fcc92");
tracker._trackPageview()

Specific Name

When using the specific name option, you can use Google Analytics classic as follows in script:

Without trackerName variable:

_gaq._getAsyncTracker("alexisclassic")._trackPageview();

With tracketName:

tracker = _gaq._getAsyncTracker("alexisclassic");
tracker._trackPageview()

DTM Google Analytics Universal

When you create a Google Analytics Universal tool, you can choose between using GA Default Name, DTM Generated Name, or Specific Name.

GA Default Name

When using the GA default name, you can use Google Analytics Universal as follows in script.

ga('send', 'pageview'); 

DTM Generated Name

When using the GA DTM generated name, you can use Google Analytics Universal as follows in script.

In this example, the tracker name is pulled from the DTM Google Analytics Universal interface:

For example:

ga('38f91ccf1ca252deaaba3c2fc421f0f3.send', 'pageview');

Specific Name

When using Specific Name, you can use Google Analytics Universal as follows in script

ga('alexisuniversal.send', 'pageview');

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online