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

497
Visualizações
Google Tag Manager - custom javascript to extract dataLayer variable

Firstly, apologies for the lack of technical know-how...

I have a datalayer variable in google tag manager which I want to extract information from using custom javascript but I'm not the most technical.

From the picture attached, I want to extract the 'Desc' part of each line separated by comma:

VCD-95K-ZL6-36T-22F, 40% Off Menswear

How would the custom javascript for this look like so I can enter it in google tag manager?

Thank you

enter image description here

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

0

Sure, here you go:

["Name:code, Desc:whatever desc is, the first desc basically", "Name:auto, Desc:the second description"]
.map(function(obj){return obj.split(/, desc:/i).slice(-1)[0]}).join(",")

The first line is just me trying to reproduce what you have in your DLV for testing purposes. The second line is what you'd have to do to your DLV, so your actual code in your custom jsvascript variable would look similar to this:

function(){
  return {{dlv - ecommerce.purchase.actionField.coupon}}.map(function(obj){return obj.split(/, desc:/i).slice(-1)[0]}).join(",");
}

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