-2

I am following the steps to implement Facebook UI Dialogs

My idea is to implement custom actions at the moment when user share a post from my website.

I have been created my app, i have placed my app url, my app domain (same to app url), and i have placed all necessary code in my site, and when i pressed button share, it throws:

Can't load url: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings

This is my code:

<script type="text/javascript">
    $(function(){
        // initialize fb sdk
        window.fbAsyncInit = function() {
            FB.init({
              appId      : 'appid',
              xfbml      : true,
              version    : 'v2.8'
            });
        };

        (function(d, s, id){
         var js, fjs = d.getElementsByTagName(s)[0];
         if (d.getElementById(id)) {return;}
         js = d.createElement(s); js.id = id;
         js.src = "//connect.facebook.net/es_LA/sdk.js";
         fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
    });

    function share_property(){
        FB.ui({
          method: 'feed',
          link: 'link',
        }, function(response){});
    }
</script>

and the html to the button:

<div class="query-submit-button pull-right">
    <input id="shareBtn" type="button" value="Compartir" onclick="share_property();">
</div>
Angel F
  • 479
  • 3
  • 13
  • What does custom actions when the user share a post mean? You have read Facebook Platform Policy? – WizKid Dec 19 '16 at 17:37
  • ie, we want to track when user does an "share" action, and save it in our db as part of statistics – Angel F Dec 19 '16 at 19:24

1 Answers1

1

You don´t need to track shares for statistics on your own, there are analytics for Apps: https://www.facebook.com/analytics/[app-id]

There is a specific page for Sharing stats: https://www.facebook.com/analytics/[app-id]/?section=link_sharing

Either way, you need to include the Domain of your App in the App settings, as the error message tells you.

andyrandy
  • 72,880
  • 8
  • 113
  • 130