I want to get some values from dataLayer object of google tag manager. In chrome tag assistance i am getting values like this
[
{
"gtm.start": 1503053374849,
"event": "gtm.js",
"gtm.uniqueEventId": 0
},
{
"event": "gtm.dom",
"gtm.uniqueEventId": 1
},
{
"event": "gtm.load",
"gtm.uniqueEventId": 2
},
{
"Linker": "_ga=53655374"
}
]
I need to get the "Linker" value. i tried dataLayer[3].Linker
but it gives me "undefined" or blank also same for dataLayer[1].event
(it's blank not return value = "gtm.dom")
When i try dataLayer[0].event
it's return correct 'gtm.js'
Please help me how to get "Linker" value
You can access the pushed data via the google tag manager javascript-api. The variable part will be the container-id of your GTM container. Make shure you adress the correct one.
google_tag_manager['<container-id>'].dataLayer.get('gtm.start');
//result e.g.: 1210115541132
The result will be the last value of the datalayers state