Expand my Community achievements bar.

Join us for the next Community Q&A Coffee Break on Tuesday April 23, 2024 with Eric Matisoff, Principal Evangelist, Analytics & Data Science, who will join us to discuss all the big news and announcements from Summit 2024!
SOLVED

Google gtag Issue (Revisited)

Avatar

Level 2

In first seeking an answer to our particular issue, I first referenced the 2018 thread: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-platform-launch/google-gtag-issue/...; however, I decided that this places a different enough spin on the issue from that which everyone else was experiencing that it warranted its own thread.

 

This again regards the Adobe Launch Google gtag Extension, which in our case is throwing a persistent browser console error that we need to get to the bottom of. The browser console error is as follows:

 

Uncaught (in promise) Error: Failed to load script https://www.googletagmanager.com/gtag/js?id=AW-XXXXXXXXX&l=OurCompanyDivision-GoogleAds(AdWords)

 

In the above URL, the red-colored text is to mask the Adwords account number as well as the initial portion of the data layer name (which is assigned in the extension's "Provide custom data layer name" field); however, the later portion of the custom data layer name is not red-colored and is actually part of the assigned data layer name as set in the extension. I point this out because someone else other than me configured this extension, but I am the one who has to figure out why it's throwing this error.

 

So, in looking at this, the one thing I was wondering about is the syntax of the custom data layer name — that it contains parentheses. Would that possibly have anything to do with the error? If so, is there any logic in the Google gtag Launch extension which might validate against any ill-formed custom data layer names an unwitting user might input into the "Provide custom data layer name" field? If there isn't, I would suggest that there should be. Based on everything I've read about the Google Tag Manager, its overriding intent is to provide an easy way for non-admin types (i.e.: marketers) to manage Adwords and other Google tagging products — and one would assume that the Launch extension would reasonably seek to follow within that same premise under the umbrella of Adobe Analytics.

 

That said, I still need an answer! LOL Can anyone pinpoint whether the custom data layer name syntax might be the culprit?


Thanks in advance for your help!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

The most common name for the data layer is "dataLayer". That's spelled with a small "d" and capital "L".

You can also view the web page's source code to find something like this:

var dataLayer = dataLayer || [];

// or
window.dataLayer = window.dataLayer || [];

You almost always never need to use a custom data layer name. It's really only needed in the rare case that the website is already using "dataLayer" for something else that is not compatible with Google's specification.

I'm not a developer of the extension, but I would guess that there's no error checking on the data layer name, because the client could really name it anything they want, e.g. "ohMyGoodness-ItsADataLayer". Using brackets would be really stretching it.

Try removing that custom data layer name and see what happens.

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

The most common name for the data layer is "dataLayer". That's spelled with a small "d" and capital "L".

You can also view the web page's source code to find something like this:

var dataLayer = dataLayer || [];

// or
window.dataLayer = window.dataLayer || [];

You almost always never need to use a custom data layer name. It's really only needed in the rare case that the website is already using "dataLayer" for something else that is not compatible with Google's specification.

I'm not a developer of the extension, but I would guess that there's no error checking on the data layer name, because the client could really name it anything they want, e.g. "ohMyGoodness-ItsADataLayer". Using brackets would be really stretching it.

Try removing that custom data layer name and see what happens.