R
R
RedDodo2019-06-04 07:30:37
JavaScript
RedDodo, 2019-06-04 07:30:37

How to assign a pixel face book event when the "add to cart" button is clicked?

I'm not a front-end at all, but just a designer, but it became necessary to add the facebook pixel event not to the page as a whole, but to a specific "add to cart" button. The site is self-written (on Tilda), so it’s impossible to solve the issue simply with the onclick attribute. I tried my best to write an add function:

<script>
    $("#rec98787508 .t750__btn t-btn t-btn_sm ").click(function(){ fbq('track', 'AddToCart', { value: 999,
currency: 'RUB',
content_ids: 'coldbloodpump',
}) });
</script>


Doesn't work. Probably spelled wrong. Could you help me write this correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Gorelov, 2019-06-04
@Kirill-Gorelov

In principle, the event works for you, what does it write in the console ??

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question