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

455
Vistas
Google Tag Manager Variable Parse Error: Primary Expression Expected

I am setting up a GTM variable, and I thought this error only came up when you don't wrap all of the code in a function.

Here is my code:

    function VIN() {
      let vins = document.getElementsByClassName("xyzClass").innerText;
      let targetVIN;
      for (var i = 0; i < vins.length; i++) {
        if (vins[i].innerText === "VIN") {
          targetVIN = vins[i].nextSibling.innerText;
        }
      }
    return targetVIN;
    });

GTM is throwing the error in the title in reference to line 2 character 2.

I'm a noob, what am I doing wrong here? Thank you in advance!

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

0

This will not work in a variable, since a custom JS variable requires an anonymous function, and yours is a named function.

It will also not work in a custom HTML tag, because GTM does not support ES6 features in custom tags and in variables (although it is partially supported in custom template, but those to do support DOM access).

If you use this in a custom tag, just replace "let" with "var".

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