Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

155
Vistas
How to capitalize first letter in Google Tag Manager Javascript variable?

SO I'm trying to capitalize the first letter of my string and make the rest lower for a GTM JavaScrip Macro variable.

But it doesn't work. When testing on normal HTML page it does work.

My code:

function() {
  var categoryUpper = {{Click Text}};
  
  function firstLetterCapital(cat) {
    return cat.charAt(0).toUpperCase() + cat.slice(1);
  }

  return firstLetterCapital(categoryUpper);
}

Does anyone know how to capitalize first letter in GTM variable?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

function() {
  var txt = {{Click Text}};
  return txt.replace(/\w\S*/g, function(t){
    return t.charAt(0).toUpperCase() + t.substr(1).toLowerCase();
  });
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda