我正试图解雇这个Facebook活动,但它不起作用?想实现一些视图跟踪,也许我有错误的方法?
<!doctype html>
<html lang="en" xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<meta charset="utf-8">
<title>Facebook Like Button</title>
</head>
<body>
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function () {
FB.init({ appId: 'xxxx', status: true, cookie: true,
xfbml: true
});
FB.Event.subscribe('edge.create', function (href, widget) {
alert('Facebook Like'); // I would like to call some tracking functionality here but does not fire:(
console.log('like');
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<fb:like></fb:like>
</body>
</html>
答案 0 :(得分:1)
你是否试图为了单元测试而开火?如果是这样,请尝试:FB.Event.fire('edge.create');
答案 1 :(得分:0)
或者只是放一个喜欢的按钮? 出于测试目的,这可能指向一个Facebook页面,因此您实际上可以与页面不同并再次尝试...