Advertisement
RodrigoOrnelas

Matriz contents

Jul 29th, 2023
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.98 KB | Source Code | 0 0
  1. function() {           // transforma matriz GA4 em matriz Contents do Facebook
  2.   var products = {{0.20 - [🕹️] Matriz items (search)}}; // substitua por sua matriz items da etapa em que se encontra
  3.   var tam = products.length
  4.   var indice=0
  5.   var viarray =[{"id":products[indice].item_id,
  6.                  "title":products[indice].item_name,
  7.                  "category":products[indice].item_category,
  8.                  "item_price":products[indice].price,
  9.                  "quantity":products[indice].quantity
  10.                 }];
  11.   var tam=tam-1
  12.     while (tam !=0){
  13.        var indice=indice+1
  14.        viarray.push ({"id":products[indice].item_id,
  15.                       "title":products[indice].item_name,
  16.                       "category":products[indice].item_category,
  17.                       "item_price":products[indice].price,
  18.                       "quantity":products[indice].quantity
  19.                       });
  20.        var tam=tam-1
  21.                     }  
  22.   return viarray;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement