
With Facebook's Social Plugins, you can seamlessly integrate specific sections of your website with the social network.
For example, you can enable "Facebook Comments" on your articles, allowing users to comment without creating new accounts, be tracked on Facebook, and even share comments on their timelines.
Ensuring GDPR compliance and proper cookie management is crucial in this context. Here’s how to install GDPR-compliant Facebook Social Plugins using My Agile Privacy's WordPress plugin.
Note: This guide uses Facebook Comments as an example, but the procedure applies to all Facebook Social Plugins listed here.
Part 1 – Locating the Social Plugin Code
First, find the code for your chosen Facebook Social Plugin. Social Plugins usually consist of two parts: a common installation segment and another segment specific to the plugin you’re implementing. For Facebook Comments, for instance, the code might look like this:
For GDPR compliance, focus on the first part—the common activation script that loads Facebook functionality on your site.
Part 2 – Adding the Facebook Social Plugin Cookie in My Agile Privacy
In your WordPress admin area, go to My Agile Privacy → Cookie List from the left menu.
Here you’ll find a list of cookies imported during plugin installation. All will be in draft status by default—publish only the cookies relevant to your site.
This screen includes columns such as:
- Cookie Name: the name of the cookie.
- Is Necessary: whether the cookie is essential for site functionality. If rejecting it breaks the site, it is pre-filled as essential.
- Auto Update: whether the reference text is kept up to date automatically for GDPR compliance.
- Installation Type: the method used to add the cookie. This may change depending on your needs (see the guides for more).
To add the cookie for Facebook Social Plugins, locate "Facebook (Facebook, Inc.) Like Button and Social Widgets" and click on it.
The detail page includes pre-filled informational text and two blank code fields. This text appears in your cookie policy and is auto-updated for compliance if "Allow Automatic Update" is enabled.
Below, select "Installation Type" (Javascript and Noscript, or Raw). Choose "Raw Code" to view the "raw html code" field.
Part 3 – Entering the Social Plugin Activation Code
Remember, the Facebook code is split into two parts: the common activation segment (entered once for all plugins) and the display part (specific to each plugin).
Paste the common activation segment into the "Html Raw Code" field.
Then, place the display section (unique to each plugin) within your theme wherever you want the plugin to appear.
Always save and publish the cookie by clicking the blue "Publish" button in the upper right corner.
Part 4 – Verifying Correct Operation
To verify the correct installation of the Social Plugin, load any page with the display code in place. You'll notice that the plugin remains inactive until explicit user consent for cookies is given.
Consent can be provided by clicking "I agree" on the cookie acceptance bar, or by going to "Customize" and enabling the cookie.