Social Plugins
Comments
Embedded Comments
Embedded Posts
Embedded Videos
Group Plugin
Like Button
Page Plugin
Quote Plugin
Save Button
Share Button
oEmbed
oEmbed (Legacy)
Child-Directed Sites
FAQs
Deprecated
Like Button for the Web
When a person visiting your webpage clicks the Like button, an App Event is triggered to log this like on Facebook.
Get a Customized Like Button
Use the Like Button Configurator to get the Like button code to insert into your webpage.
Set the URL of your webpage where you are placing the Like button
Customized your Like button
See a preview of your button
Click the Get Code, and copy and paste the code into your webpage
Like Button Configurator
URL to Like
Width
Layout
standard
Action Type
like
Button Size
small
Include Share Button
Get Code
Note, if you are already logging app events, remove the autoLogAppEvents=1 statement from the button code to prevent duplicate logging.
Use Open graph meta tags to edit your link preview. The og:url tag and data-ref attribute should be the same URL.
Full Code Example
Formatted for readability.
Your Website Title
Like Button HTML5 Attributes
HTML5 Attribute Description
data-action
The verb to display on the button. Can be either like (default) or recommend.
data-colorscheme
The color scheme used by the plugin for any text outside of the button itself. Can be light (default) or dark.
data-href
The URL of the webpage that will be liked.
data-kid-directed-site
If your website or online service, or a portion of your service, is directed to children under 13 you must set this to true. Default is false.
data-layout
Selects one of the different layouts that are available for the plugin. Can be one of standard (default), button_count, button or box_count. See the FAQ for more details.
data-lazy
true means use the browser's lazy-loading mechanism by setting the loading="lazy" iframe attribute. The effect is that the browser does not render the plugin if it's not close to the viewport and might never be seen. Can be one of true or false (default).
data-ref
A label for tracking referrals which must be less than 50 characters and can contain alphanumeric characters and some punctuation (currently +/=-.:_). See the FAQ for more details.
data-share
Specifies whether to include a share button beside the Like button, true or false (default). This only works with the XFBML version.
data-size
The button is offered in 2 sizes i.e. large and small (default).
data-width
The width of the plugin (standard layout only), which is subject to the minimum and default width. Please see the Layout Settings table for more details.
Layout Settings
Layout Settings are optional.
Layout Default Sizes
standard
Minimum width: 225 pixels.
Default width: 450 pixels.
Height: 35 pixels (without photos) or 80 pixels (with photos).
box_count
Minimum width: 55 pixels.
Default width: 55 pixels.
Height: 65 pixels.
button_count
Minimum width: 90 pixels.
Default width: 90 pixels.
Height: 20 pixels.
button
Minimum width: 47 pixels.
Default width: 47 pixels.
Height: 20 pixels.
Change the Language
You can change the language of the Like Button by loading a localized version of the Facebook JavaScript SDK. Replace en_US with your locale, for example, fr_FR for French (France).
js.src = "https://connect.facebook.net/fr_FR/sdk.js#xfbml=1&version={graph-api-version} />";
The width of a Social Plugin may need to be adjusted to accommodate different languages.
See Also