forked from AllanTracker/codigos-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JSC - matriz yampi
23 lines (23 loc) · 1.04 KB
/
JSC - matriz yampi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function() { // transforma a matriz da Yampi no padrão GA4
var products = {{dlv - ecommerce.items}}; //matriz de produtos no padrão GA4
var tam = products.length
var indice=0
var viarray =[{"item_id":products[indice].shopify_product_id,
"item_name":products[indice].product_option.product.name,
"item_category":products[indice].short_description,
"price":products[indice].product_option.price_discount,
"quantity":products[indice].quantity
}];
var tam=tam-1
while (tam !=0){
var indice=indice+1
viarray.push ({"item_id":products[indice].shopify_product_id,
"item_name":products[indice].product_option.product.name,
"item_category":products[indice].short_description,
"price":products[indice].product_option.price_discount,
"quantity":products[indice].quantity
});
var tam=tam-1
}
return viarray;
}