Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
how to read specific dataLayer obj in gtm custom template

when I try below to access datalayer in custom template using copyFromWindow,

`if (queryPermission('access_globals', 'readwrite', 'dataLayer')) {
     const dataLayer = copyFromWindow('dataLayer');
      log('dataLayer =', dataLayer.length);
}`

output :` `[{"gtm.start":1631682185554,"event":"gtm.js","gtm.uniqueEventId":3}]

I am trying to access say 13th item in the dataLayer array I can get the value by doing dataLayer[13].segments in console. But unable to figure out how to do this in the custom template

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!