arrays - Google Tag Manager > dataLayer variable find and replace with javascript variable -


i'm having trouble google tag manager datalayer variable not contain right information.

the "sku" field not named correctly , need change "variant". i'm trying achieve custom javascript variable in gtm whatever i'm trying i'm not able find , replace "sku" "variant" in products array.

all appreciated.

many in advance, adriaan

enter image description here

you can create custom javascript variable uses old array , replaces product parameters, that:

var arr = {{yourproductarray}}; //check if valid array  arr.foreach(function(prod, index, array){   if(prod.sku) {     arr[index].variant = prod.sku;     arr[index].sku = ""; //reset value if needed   } });  return arr; 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -