Friday Madness

40%

Grab Discount
Mon. - Fri. 9 am - 5 pm Ask a Question
Remember me

fb pixel добавление в корзину.

4 weeks 16 hours ago #1

  • artem's Avatar
  • artem
  • Posts: 10
Добрый день, gridbox.

Как назначить событие pixel face book при нажатии кнопки «в корзину» в компоненте store?
<script>
fbq('track', 'AddToCart');
</script>
Attachments:

4 weeks 16 hours ago #2

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 20435
Здравствуйте ,
Благодарим Вас за обращение к нам

Вам нужно использовать (добавить в редактор кода) этот JS код:
document.addEventListener('DOMContentLoaded', function(){
    jQuery('.ba-add-to-cart-buttons-wrapper a').on('click', function(){
        fbq('track', 'AddToCart');
    })
})

С уважением,
Вячеслав, Balbooa.com

4 weeks 16 hours ago #3

  • artem's Avatar
  • artem
  • Posts: 10
Большое спасибо!

4 weeks 16 hours ago #4

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 20435
Пожалуйста ;)

3 days 18 hours ago #5

  • Artur's Avatar
  • Artur
  • Posts: 73
Hi i want to set track after purchase so best way is to set it when thankYou page show up, how to enable it with the above method?

3 days 18 hours ago #6

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 20435
Hello,
Thank you for contacting us

You need to add a custom html plugin with a script on the Thank You page
Example
<script>fbq('track', 'AddToCart'); </script>

Regards,
Vyacheslav, Balbooa.com

3 days 18 hours ago #7

  • Artur's Avatar
  • Artur
  • Posts: 73
Do You think that this one will work?

but first I need to add class to ThankYou page like .thankyou

or maybe I can use some other way to check if thank you page show up?
document.addEventListener('DOMContentLoaded', function(){
    const flag = jQuery('.thankyou').length
    if (flag) {
        fbq('track', 'Purchase');
    }
})

3 days 17 hours ago #8

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 20435
If the code is added on a page, then it only works on this page (no need to check)

Best Regards,
Vyacheslav, Balbooa Support Team

3 days 17 hours ago #9

  • Artur's Avatar
  • Artur
  • Posts: 73
OK right I do it Yours, easiest way ;) thx

3 days 17 hours ago #10

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 20435
You are welcome ;)
Powered by Kunena Forum