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

138
Vistas
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 Respuestas
Responde la pregunta

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 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