sun
sun

Reputation: 1668

what is facebook app ID?

Hi i'm trying to place a facebook like button in website With the following code

    <div id="fb-root"></div>
<script>(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/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));



  FB.Event.subscribe('edge.create',
         function(response) {
             alert("Thank you for liking my page"); 
         }
    );



</script>

<div class="fb-like-box" data-href="https://www.facebook.com/mypage" data-width="292" data-show-faces="true" data-stream="true" data-show-border="true" data-header="true"></div>

But the FB.Event function not working when i tested, I think i can use this trigger event only if i use FB.init and running inside fbAsyncInit() function.this came to know by searhing web.

i don't know these things exactly.Now the problem is Fb.init require appId,channelUrl and few more.I'm confused i didn't created any Application and i'm not creating i'm just trying to place a facebook like button to my website then how come can i provide appId.

Can anyone explain me about this appId.Does it required to create like button and to create Fb.event when a user likes my page like thanking them or am i using the given code wrongly?

Upvotes: 4

Views: 22695

Answers (2)

KajMagnus
KajMagnus

Reputation: 11666

Here's some docs about the app id — search for fb:app_id on this page: https://developers.facebook.com/docs/sharing/webmasters#markup

You specify the app id, so that you can use Facebook Domain Insights to view analytics for traffic to your website from Facebook. Apparently FB Domain Insights is some FB tool that webmasters can use to get information about how the content on their website get shared inside Facebook.

However the FB page about Facebook Domain Insights is gone ... and instead says you should look for some "platforminsights" tool. I suppose FB made some changes to their analytics stuff, recently.

Upvotes: 0

andyrandy
andyrandy

Reputation: 73984

It is recommended to use an App Id for every Social Plugin (like the Like Button).

And here´s an overview of how you should implement the Facebook SDK:

https://developers.facebook.com/docs/javascript/quickstart

You better place that FB.Event code right where it says "Additional initialization code..." - Because right now, you are using "FB" when it´s not even initialized.

And this is where you can create an App: https://developers.facebook.com/apps

Upvotes: 1

Related Questions