我们无法控制亚马逊按钮的代码,因为亚马逊自己生成了它。
我的问题是我可以在外面这样做吗?
$j(#OffAmazonPaymentsWidgets0).click({
_gaq.push(['_trackEvent', 'Category', 'Action', 'Extra Label if you like!']);
});
谢谢!
答案 0 :(得分:1)
授权回调中的JS代码在单击按钮时执行。所以你可以这样做:
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
}
});