Like FB page doesn't fire edge.create event after confirming

早过忘川 提交于 2019-11-29 14:15:02

I suspect this is a bug from the new Facebook's update. You can search for the issue here https://developers.facebook.com/bugs, also can post a new bug if it hasn't been reported yet

You can no longer subscribe to edge.create. At this time (04/2018) it is still in the documentation, but it is deprecated and to be fully removed in the near future.

By design, there is no way for a third party application to know when the Like button is clicked.

You will need to design your app in a way that does not require you to know when the Facebook Like button provided in the iframe is clicked.

Referencing this bug report:

The edge.create event is deprecated (https://developers.facebook.com/docs/plugins/faqs/), so the engineers have decided not to fix it for this case since it will be taken out completely in the future api release.

And from this one:

I understand that it's important to you, but unfortunately we did the deprecate on purpose due to policy issue.

Developers are not supposed to check the user press any more.

These Events will no longer be accessible. As an alternative, you can use our Webhooks and be notified every time someone likes one of your Facebook Pages.

This is the webhooks endpoint

Source

Working solution until now:

<!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>
    window.fbAsyncInit = function () {
        FB.init({appId: '1906177386133148', status: true, cookie: true, xfbml: true});
        FB.Event.subscribe("edge.create", function (targetUrl) {
            console.log('edge.create');
        });
        FB.Event.subscribe("edge.remove", function (targetUrl) {
            console.log('edge.remove');
        });
    };
    (function () {
        var e = document.createElement('script');
        e.async = true;
        e.src = document.location.protocol + '//connect.facebook.net/es_ES/all.js';
        document.getElementById('fb-root').appendChild(e);
    }());
</script>
<fb:like></fb:like>
</body>
</html>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!