Shopify / buy-button-js

BuyButton.js is a highly customizable UI library for adding ecommerce functionality to any website.

Home Page:http://shopify.github.io/buy-button-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I'm using DOMEvents on a button for tracking - how do I add the event back to go to checkout?

jasonbraun opened this issue · comments

I need to add an AddToCart event to a buy button for FB Pixel tracking - when I use DOMEvents to add it like this:

"product": {
 "DOMEvents": {
   'click .shopify-buy__btn': function () {
     fbq('track', 'AddToCart');
   }
},

That overrides the default click event of going to checkout - is there a way to add the event back? I've looked through the docs and past issues here and can't find anything. I saw ui.openCart() mentioned, but I want the button to go directly to the checkout page instead.

Was there ever a conclusion here? I'm facing the same issue now.

"DOMEvents": {
'click .shopify-buy__btn-wrapper .shopify-buy__btn': function (evt, target) {

fbq('track', 'AddToCart', {