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

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

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