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

198
Views
How to get specific element from page to variable in Google Tag Manager

I have this kind of cookie in code on page. I would like to get language out of it.

I mean how could I this function return in this example "en" in GTM variable:

function() {return ...}

Code in page looks like:

<script type="text/javascript" id="wtml-cookie-js-extra">
var wtml_cookies = {"wp-wtml_current_language":{"value":"en","expires":1,"path":"\/"}};
var wtml_cookies = {"wp-wtml_current_language":{"value":"en","expires":1,"path":"\/"}};</script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Global variables like that are accessible in the window object. This code should do it:

function() {
  return window.wtml_cookies["wp-wtml_current_language"]["value"];
}
about 4 years ago · Juan Pablo Isaza Report
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!