AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

2.7K members online now
2.7K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
Guide Me

GTM - Data layer with no code ?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello Google Community,


I'm using google tag manager which is quite easy to use when it's about setting up the analytics tag,

but really getting tricky when it comes to data layer.

At least, it is for me.

I'm gathering information across many sources, but there're many things that I still don't understand.


Here are some questions to clear up my mind :


- How is it possible to "have a datalayer" (seen in the debug mode of the GTM) when no extra code (other than GTM) has been implemented ?


- I use a custom HTML to do scrolltrack (thanks to Julian Juenemann - . And It worked. This custom HTML pushed data into the data layer without having to do any code modification/implementation. Why there no such thing as standard feature already in GTM ?


And that's it for now.

Maybe these questions are nonsense cause I don't really grab the whole thing,

but I need to figure this out.



Thanks for any help I'm sure you will provide Smiley Happy






Re: GTM - Data layer with no code ?

Follower ✭ ✭ ☆
# 2
Follower ✭ ✭ ☆
Hi Thomas,

A good way to go about the dataLayer is to initialize it right before the GTM snippet, this way you can pass dataLayer information before the pageview fires.
dataLayer = [{
'testVariable' : 'test'

In debug mode you can the Data Layer by clicking on the Data Layer button beside variables in the debug console.

To easily push data into the dataLayer all you do is put this code where ever you want to push a new dataLayer variable:
dataLayer.push({ 'testVariable' : 'test" });

Hopefully this helps,