AddThis Academy

An ever-growing library of resources to help you become a better online marketer.

Changes to How the Facebook API Works

As of 9/11/2017, we’ve identified a new issue with sharing to Facebook using their API. We will update this article when the issue has been resolved.

In July, Facebook changed how their sharing API works in a way that affects AddThis publishers. Previously, you could specify the data-title and data-image attributes in the AddThis tools to specify the title and image to use when sharing to Facebook. This API change removed this ability, and prevented users from sharing to Facebook as expected in some instances.

Because Facebook is our number one sharing service, we got to work on a solution right away.

First, we focused on making sure that sharing to Facebook worked. Once we ensured that basic functionality was working, we started on a more complex, but better solution that restored full functionality. This solution requires that in some cases, the Facebook JavaScript SDK is loaded on the page, so that the data- attributes work like they did before, but with a slight change.

Note: In most cases with this change you won’t have to do anything.

If you have a Facebook share button on the page with data-title or data-image attributes that don’t match the Open Graph tags, and that also don’t match the on-page attributes (e.g., the HTML title tag), we’ll check for the Facebook JavaScript SDK and, if it’s not on the page, will dynamically load it so that the data- attributes are respected (if you’ve already put the SDK on the page, then we’ll just use that and avoid any additional requests). In this case, you will also have to sign up for a Facebook app id and put it on your pages. To do this, go here and follow the steps to sign up for your app id and set your redirect URL. Then, modify your site’s theme or template to add this to every page:

addthis_share = {
    passthrough: {
        facebook: {
            app_id: 'Insert Your Facebook App ID',
            redirect_uri: 'Insert Your Facebook App Redirect URI'
        }
    }
}

Remember, you only have to do this if the data-title, data-url, and data-image attributes of the AddThis tools are different from both the HTML tags on the page *and* the Open Graph (og:) tags. Also, the redirect URI should be the domain that you’re sharing from.

This solution restores full functionality for Facebook sharing and keeps the number of requests as small as possible. If you have more questions about Facebook sharing, please contact our support team at help@addthis.com or on Twitter at @addthissupport.

Changes to How the Facebook API Works
1 (20%) 1 vote

Was this article helpful to you?