開發人員最新消息
Adding More Features to the Like Button

Since it launched in April, the Like button has given you the opportunity to make your websites more social in just a few steps. Today, we’re releasing more features for the Like button to add even more value to your site.

  • Commenting for the iFrame version
  • Publishing to connected users via the Graph API
  • More robust analytics

Commenting Now Enabled with IFrame Version

Now, when a user adds a comment to the iFrame version of the Like button, a larger, more prominent story will be shared with the user’s friends. In the past, we’ve seen comments result in increased distribution and referral traffic. To enable this feature, ensure that you are using layout="standard" and the width of the button is at least 450 pixels. Take a look at this example.

Publishing to Connected Users via Graph API

We encourage websites with objects that people may want to more permanently connect with, such as a brand or product, to publish relevant updates to its connected users. For example, publish a special offer to users who have liked a specific product. Simply add a few Open Graph tags to your Web page and click on the Admin Link (only visible to admins) to use the Publisher.

If you’re publishing to more than a handful of Pages, you now have the ability to publish to multiple Open Graph Pages via the Graph API. Just ensure that the fb:app_id <meta> tag is specified on the Web page and do the following.

First, get an access token for your application:

curl -F type=client_cred \
-F client_id=your_app_id \
-F client_secret=your_app_secret \
https://graph.facebook.com/oauth/access_token

Using this access token and the URL of your page, you can publish to users via the API with:

curl -F 'access_token=...' \
-F 'message=Hello Likers' \
-F 'id=http://www.myopengraphpage.com/page1.html' \
https://graph.facebook.com/feed

We’ve updated our documentation with these new features.

Analytics

We recently added the ref and source parameters to help you test and optimize Like button performance on your website (read more about the attributes).For instance, you can now easily A/B test different types and placements of the Like button to determine the implementation that maximizes referral traffic to your site.

Frequently Asked Questions

Which Like button is most effective for my Web page?

Use the ref attribute to help you test different placements and types of Like buttons. Append the ref="" attribute to the Like button, making sure that the value you choose is less than 50 characters (a-z, A-Z, 0-9, + / = - . : _). Here are two examples:

<fb:like ref="top_left">
<iframe src="... &ref=top_left">

When a user clicks a link back to your website, we will append &fb_ref="" to the referrer URL. Links from aggregated News Feed stories will contain all ref parameters separated with commas.

Where on Facebook did the link get clicked?

When you use the ref parameter, we will also add a new fb_source parameter to our referrer URLs, which includes the stream type ('home', 'profile', 'search', 'other') where the click occurred and the story type ('oneline', 'multiline') concatenated with an underscore. For example:

http://www.facebook.com/profile.php?fb_ref=top_left&fb_source=profile_oneline

We sanitize referrer URLs from Facebook to protect user privacy, but this parameter allows us to remove personally identifiable information while still exposing anonymous, yet useful data for developers interested in tracking and optimizing the performance of their Like buttons.

Austin Haugen, a product manager on Facebook Platform, hopes you like the Like button updates.