Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
141 views
in Technique[技术] by (71.8m points)

javascript - gtag events begin_checkout

I tried add event for begin_checkout and I have a problem.

       obiect_final = "";
    obiect_final += "[";
    $('.produs_cos').each(function(){   
        obiect_final += '{"id":'+$(this).find('.id_produs').val()+',"name":"'+$(this).find('.nume_produs').val()+'","list_name":"","brand":"","category":"","variant":"'+$(this).find('.optiune_produs').val()+'","list_position":1,"quantity":"'+$(this).find('.cantitate_produs').val()+'","price":"'+$(this).find('.pret_produs').val()+'"},';
    });
    obiect_final = obiect_final.slice(0, -1);
    obiect_final += "]";
    
    console.log(obiect_final);

    gtag('event', 'begin_checkout', {
      "items": obiect_final,
      "coupon": "",
    });

This is the console.log:

[{"id":489,"name":"Ceai alb Mao Feng Vietnam ","list_name":"","brand":"","category":"","variant":"Greutate: 100 g ","list_position":1,"quantity":"1","price":"33,50 LEI"},{"id":493,"name":"Ceai Ayurveda Pure","list_name":"","brand":"","category":"","variant":"Greutate: 100 g ","list_position":1,"quantity":"2","price":"22,00 LEI"}]

The event is tracked without items array. I think its a problem with items array, but I dont see where. Can you help me?

Thank you!!

question from:https://stackoverflow.com/questions/65851461/gtag-events-begin-checkout

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...