Meta Ads Plugin allows you to install and manage the Meta Business Extension, create Facebook ads, and view ads insights on websites you manage.
If you already have an Meta Business Extension entry point implemented, setting the configuration the same as the existing Meta Business Extension entry point will allow the Ads Plugin to detect that Meta Business Extension has been installed, and users will be able to see the Create Ad button without going through the Meta Business Extension flow again.
You will need:
The Ads Creation plugin takes the merchant through Meta Business Extension installation if Meta Business Extension is not already set up for the business (verifies if Meta Business Extension is installed for the external business id) and shows the Create Ad button to the Facebook lightweight ad interface when Meta Business Extension is installed.
Add the following code on the webpage with appropriate values for the Ads Creation widget to appear. See Reference for field descriptions.
Formatted for readability.<div class="fb-lwi-ads-creation"
data-fbe-extras="<extras-for-fbe-configuration>"
data-fbe-scopes="<permission-scopes>"
data-fbe-redirect-uri="<url-to-be-redirected-to-when-popup-closes>"
></div>Ads Insights plugin takes the merchant through Meta Business Extension installation if Meta Business Extension is not already set up for the business (verifies if Meta Business Extension is installed for the external business id) and shows ads performance such as reach, purchases and spending.
Add the following code on the webpage with appropriate values for the Ads Creation widget to appear. See Reference for field descriptions.
Formatted for readability.<div class="fb-lwi-ads-insights"
data-fbe-extras="<extras-for-fbe-configuration>"
data-fbe-scopes="<permission-scopes>"
data-fbe-redirect-uri="<url-to-be-redirected-to-when-popup-closes>"
></div>| Field | Description |
|---|---|
Type: string | Required. Defines Meta Business Extension-specific flows, such as the features and settings used to configure for the seller. |
Type: string | Required. URI to be redirected to when the pop-up closes after Meta Business Extension install. The redirect url has the code and state parameters. The code can be exchanged for an access token. If Webhook is implemented, you will receive the access token through a Webhook Meta Business Extension install event. |
Type: string | Required. The Optionally, include appropriate scopes for Meta Business Extension installation such as |
Type: string | Optional. A string value created by your app to maintain the state between the request and callback. This parameter should be used for preventing cross-site request forgery and will be passed back to you, unchanged, in your redirect URI. |
Type: string | Optional. Partners can configure which ad objectives to surface in the ad creation plugin by inputting upto 4 objectives in a comma separated string in the order of preference. User eligibility for the objective will be checked and users will be shown at most 3 eligible objectives in the preference order. Supported options are: Default value is: |
Type: boolean | Optional. True hides the explore more options on the ad creation plugin. When the value is true, if the user is not eligible for any of the configured options, a Create ad button will be shown instead. |
Type: boolean | Optional. True means use the browser's lazy-loading mechanism by setting the |
You can change the language of the embedded comments plugin by loading a localized version of the Facebook JavaScript SDK. When you load the SDK, change the value of src to use your locale. Replace en_US with your locale, for example fr_FR for French (France):
src="https://connect.facebook.net/fr_FR/sdk.js#xfbml=1&version={latest-api-version}"You may need to adjust the width of a Social Plugin to accommodate different languages.
<body>
<script>
window.fbAsyncInit = function () {
FB.init({
appId: "your-app-id",
autoLogAppEvents: true,
xfbml: true,
version: "v11.0",
});
};
</script>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js"></script>
<h3>Ads Creation</h3>
<div
class="fb-lwi-ads-creation"
data-fbe-extras="{'business_config':{'business':{'name':'Sample Business'}},
'setup':{'external_business_id':'my-sample-business',
'timezone':'America/Los_Angeles',
'currency':'USD',
'business_vertical':'ECOMMERCE'},
'repeat':false}"
data-fbe-scopes="manage_business_extension,ads_management"
data-fbe-redirect-uri="https://samplebusiness.commerceapp.com/marketing/fb"
></div>
<h3>Ads Insights</h3>
<div
class="fb-lwi-ads-insights"
data-fbe-extras="{'business_config':{'business':{'name':'Sample Business'}},
'setup':{'external_business_id':'my-sample-business',
'timezone':'America/Los_Angeles',
'currency':'USD',
'business_vertical':'ECOMMERCE'},
'repeat':false}"
data-fbe-scopes="manage_business_extension,ads_management"
data-fbe-redirect-uri="https://samplebusiness.commerceapp.com/marketing/fb"
></div>
</body><body>
<div
class="fb-lwi-ads-creation"
data-fbe-extras="{'business_config':{'business':{'name':'Sample Business'}},
'setup':{'external_business_id':'my-sample-business',
'timezone':'America/Los_Angeles',
'currency':'USD',
'business_vertical':'ECOMMERCE'},
'repeat':false}"
data-preferred-ad-options='MESSAGES, CATALOG_SALES, WEBSITE_VISITS'
data-fbe-scopes="manage_business_extension,ads_management"
data-hide-explore-more-options=false
data-fbe-redirect-uri="https://samplebusiness.commerceapp.com/marketing/fb"
></div>
</body>Be sure to replace your-app-id with an actual app id value for the sample code to work on your webpage. After the quick test, replace all fields with the appropriate values.