Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

272
Visualizações
Parse error. '}' expected when using dot notation with data layer variable data

I have an object that I have added to the datalayer that has an array in it. In a custom html tag (javascript), I can pull the data out just fine. And it is still a well formed object. But when I use the dot notation to access the array, Tag Manager gives the error

Error at line 10, character 39: Parse error. '}' expected

Line 10 is the authData line below. And this happened when I click the Preview button to test the changes.

<script>
    var dlv = {{dlv - My-Variable}};
    var authData = { email: dlv.Items.0.Shipment.Address };
</script>

I have followed the steps in this post. https://www.simoahava.com/gtm-tips/access-array-members-in-the-data-layer/

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

An element in an index-dased array should be accessed using square bracket notation, like someArray[5]

 var authData = { email: dlv.Items[0].Shipment.Address };

And a variable can't have "-" in its' name, because it's confusing JavaScript, wheteher "-" should be treated as arithmetical operator or as a part of a variable name

 My-Variable

And the interpolation braces are used in JSX, not in JavaScript

 {{ }}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda