RodrigoOrnelas

Deixando a matriz items organizada a partir de uma do dataLayer

Jul 29th, 2023 (edited)
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.54 KB | Source Code | 0 0
  1. function(){
  2.  
  3.     var DadosBrutos = {{0.20 - [🔌] listProducts}};
  4.     var items = [];
  5.  
  6.     for(var i = 0; i < DadosBrutos.length;i++){
  7.         var indice = DadosBrutos[i];
  8.  
  9.         var format_ga4 = {
  10.                         "item_id":indice.idProduct,
  11.                         "item_name":indice.nameProduct,
  12.                         "item_category":indice.category,
  13.                         "price":indice.price,
  14.                         "quantity":1
  15.                        }
  16.         items.push(format_ga4);
  17.     };
  18.  
  19. return items;
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment