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

110
Visualizações
Enhanced E-Commerce value to Custom JS Variable in Tag Manager

the store I manage sends data to Google Analytics - Enhanced E-Commerce using the following code and not via dataLayer.

ga('ec:setAction', 'purchase', {
    'id': '1014',
    'revenue': '69.06',
    'shipping': '0.00',
    'tax': 0
});

ga('send', 'pageview');

Now, how can I add the value of the 'revenue' to a Tag Manager variable?

I tried the following code in a Custom Java Script Variable but it's not working.

ga(function() {
  var test = ga.getByName('revenue');
  return test;
})
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Now exactly because you didn't push the revenue to the DL, you won't be able to access it in GTM.

You could, technically, still get it by some obscure overridal of the ga() function, but that would be an overkill.

Another option would be trying to parse the value from DOM or looking for it in the global scope.

The best route from here, however, would be explicitly pushing the information you need to the dataLayer to make it available for GTM. That is one important benefit of using DL-based EEC tracking: you have all the information available in case it's needed for other tags. Third-party tags often want to know things like totals, transaction ids and such for proper attribution.

Having said that, I would suggest never calling the ga function directly. Having all tracking in one place (GTM/DL) makes it a lot easier to debug. Especially for the people who come after you.

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