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

Analytics
4.8K members online now
4.8K 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
star_border
Reply

dataLayer updated in tag manager quick preview not in real time events

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 

I am having an issue where I can see the data layer being updated in the tag manager preview, but if I look at the real time events in the tag manager console I see nothing fired. I also added the google tag assistant chrome extension and I never see the data layer updated there either. 

 

My code is as follows:

 

dataLayer.push({'category': 'Intro Video', 'action': 'Pause'});

 

I am unsure why the event fires in the preview but not on the site. Also to add to the understanding the first event I am firing which is:

 

dataLayer.push({'category': 'Video', 'action': 'Play', 'label': $(el).data('title')});

Does fire and updates the dataLayer in the real time event tracking.

 

Screen Shot 2016-02-12 at 3.50.03 PM.png

 

Thanks for any help!

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author FriendsElves D
February 2016

Re: dataLayer updated in tag manager quick preview not in real time ev

Top Contributor
# 4
Top Contributor
Hi FriendsElves D,

So now that you have the particular event key "User Interaction" in the dataLayer push, you need have an Event tag in GTM that is triggered by the event "User Interaction". In that tag, you can pass it the same category, action, and label from the dataLayer (in which case you would need to also include those a new dataLayer type variables in GTM.

Just so there's no confusion, the dataLayer push by itself will not fire anything in GTM. It merely is a way for you to pass information that GTM can use. You need to create the tags and variables in GTM to access the dataLayer.

Hope this helps.
Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn

View solution in original post

Re: dataLayer updated in tag manager quick preview not in real time ev

Top Contributor
# 2
Top Contributor
Hi FriendsElves,

No event would be fired, as expected, based on the dataLayer push you're showing. You need to fire the GA event based on an "event" key in the dataLayer. So you would need something like:

dataLayer.push({
'event': 'my event',
'category': 'Video',
'action': 'Play',
'label': 'Never Cave'
})

Your tag should then be configured to fire based on the event 'my event'.
Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn

Re: dataLayer updated in tag manager quick preview not in real time ev

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thank you Nicky,

I have added an event to the dataLayer push which you can see below. Even with this event in place I am still not seeing anything being tracked. What did you mean by the tag should then be configured to fire? Is there another step I am missing other than adding the 'event'? As you can see below this event fires in the preview still but nothing in the tracking panel.

 

Screen Shot 2016-02-15 at 2.33.16 PM.png

Here is the link for reference if that helps:

http://www.nick.com/legoelves/fun/videos/never-cave

Marked as Best Answer.
Solution
Accepted by topic author FriendsElves D
February 2016

Re: dataLayer updated in tag manager quick preview not in real time ev

Top Contributor
# 4
Top Contributor
Hi FriendsElves D,

So now that you have the particular event key "User Interaction" in the dataLayer push, you need have an Event tag in GTM that is triggered by the event "User Interaction". In that tag, you can pass it the same category, action, and label from the dataLayer (in which case you would need to also include those a new dataLayer type variables in GTM.

Just so there's no confusion, the dataLayer push by itself will not fire anything in GTM. It merely is a way for you to pass information that GTM can use. You need to create the tags and variables in GTM to access the dataLayer.

Hope this helps.
Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn

Re: dataLayer updated in tag manager quick preview not in real time ev

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

I believe what Nicky is saying is that in addition to your dataLayer event, you'll need a GA Event tag in GTM.  This can take the information you are pushing onto the dataLayer and pass it into GA, which is required because GA will not automatically pick up the dataLayer data on its own.

 

See https://support.google.com/analytics/answer/6164470?hl=en for a basic example.

dataLayer updated in tag manager quick preview not in real time events

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

Hi Nicky,

I have one question on GT.

I have java script function updateDataLayer() which is calling from another function updateProductDetails(productDetailsObj). I am trying to update the dataLayer with product object in updateDataLayer() but it is not happening. please find the below code. could you please help on this?

Please note - on page load it is working fine but if i call the below function explicitly then it is not updating in DataLayer object in Google Tag Assis Addon - but able to see it in console log. 

function gtDataLayerUpdate(phoneObject){
phoneObject = {
'id' : 'phoneObject.id',
'model' : 'phoneObject.id',
'price' : 'phoneObject.id',
'storage' : 'phoneObject.id',
'staticMessage' : 'phoneObject.id',
}
alert(window.location.href +"-- "+phoneObject);
window.dataLayer.push({
"event":"gtm.historyChange",
"gtm.historyChangeSource": "replaceState",
"ecommerce": {
"currencyCode":"NZD",
"click": {
"actionField": {"list":"category" },
"products": [{
"id"Smiley TonguehoneObject.id,
"name"Smiley TonguehoneObject.model,
"price"Smiley TonguehoneObject.price,
"memory"Smiley TonguehoneObject.storage,
"stocklevel"Smiley TonguehoneObject.staticMessage,
"category":"/phone",
"refer" : "/phone-listing.jsp"
}]
}
}
});
}

 

Regards,

RAma