Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

The following codes have worked before but not now. Since FB added the confirm box when liking a page, the edge.create was no more fired after confirming.

    <div class="fb-page" data-href="{{ $fbPageUrl }}" data-tabs="timeline" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"></div>
    <script>
        $(document).ready(function() {
            $.getScript('//connect.facebook.net/en_US/sdk.js', function(){
                FB.init({
                    appId      : 'xxxxxxxxxxxxxx',
                    xfbml      : true,
                    version    : 'v2.9'
                });

                FB.Event.subscribe('edge.create', function(response) {
                    alert('Fired!');
                });
            });
        });
    </script>
like image 523
Hoang Trung Avatar asked Oct 06 '17 10:10

Hoang Trung


1 Answers

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.

like image 117
Barrett H. Avatar answered Nov 10 '22 15:11

Barrett H.