Shopify buy button Facebook add to cart traking

Hi all,

Really need your help here!

I'm having trouble to tie the AddToCart event to an On Click event (when we click on a button only). Right now, the add to cart event fire on page load.

So, I would like to know exactly where I need to place this script:

in the following code (This is the Shopify Buy Button Integration):

Asked about a month ago