forked from AllanTracker/codigos-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFb - Matriz Contents
23 lines (23 loc) · 940 Bytes
/
Fb - Matriz Contents
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 matriz GA4 em matriz Contents do Facebook
var products = {{dlv - ecommerce.items}}; //matriz de produtos no padrão GA4
var tam = products.length
var indice=0
var viarray =[{"id":products[indice].item_id,
"title":products[indice].item_name,
"category":products[indice].item_category,
"item_price":products[indice].price,
"quantity":products[indice].quantity
}];
var tam=tam-1
while (tam !=0){
var indice=indice+1
viarray.push ({"id":products[indice].item_id,
"title":products[indice].item_name,
"category":products[indice].item_category,
"item_price":products[indice].price,
"quantity":products[indice].quantity
});
var tam=tam-1
}
return viarray;
}