1

We cannot control the code of Amazon button because Amazon Generated it themselves.

My question it can I do it externally like this?

$j(#OffAmazonPaymentsWidgets0).click({
_gaq.push(['_trackEvent', 'Category', 'Action', 'Extra Label if you like!']);
});

Thanks!

4

1 回答 1

1

The JS code within the authorization callback is executed upon click of the button. So you could do something like this:

var authRequest;
OffAmazonPayments.Button("AmazonPayButton", "YOUR_SELLER_ID_HERE", {
  type:  "PwA",
  color: "Gold",
  size:  "medium",
  useAmazonAddressBook: true,
  authorization: function() {

    // additional on click code
    _gaq.push(['_trackEvent', 'Category', 'Action', 'Extra Label if you like!']);

    var loginOptions = {scope: 'profile payments:widget'};
    authRequest = amazon.Login.authorize(loginOptions, "YOUR_REDIRECT_URL_HERE");
  },
  onError: function(error) {
    // Write your custom error handling
  }
});
于 2016-02-05T16:56:51.310 回答