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

137
Visualizações
Simo Ahava or Google doc? Question on dataLayer.push({ ecommerce: null });

While setting up GTM I came across a crossroad and I don't know which option is best, and why.

Simo Ahava declares window.dataLayer before any snippet, and does not clear the ecommerce object

Screenshot of a snippet by Simo, using window.dataLayer and not clearing ecommerce object

On the other side, Google recommends clearing the ecommerce object before any ecommerce event to prevent any potential issues with variables using datalayer v1. The way google puts it is "to prevent multiple ecommerce events on a page from affecting each other"

Google clears ecommerce object and uses a different syntax

Google's method sounds better to me here, although Simo is arguably the most respected guy in the tracking space.

So which method is the best, and why?

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

0

I do not think these two snippets cover the same use cases. Simo talks about initializing the datalayer (usually before the GTM snippet, there would be little point in doing this afterwards), the second snippet assumes that the dataLayer object already exists.

So this is not "one or the other", but ideally you do both - setting up the dataLayer before the GTM snippet, but also clearing the e-commerce object between two unrelated e-commerce pushes.

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