Facebook Pixel: Consent and cookies
How the Facebook Pixel plugin for Shopware 6.7 handles consent: Klaro integration, recognised consent cookies, behaviour without consent and the Klaro service that is created on activation.
Facebook Pixel: Consent and cookies
Live Demo: Try this and other plugins live — no installation, no risk: demo.markus-michalski.net
The plugin has three operating modes. Which one applies depends on two settings. The same rule applies to the browser and to the Conversions API.
| Mode | Settings | Pixel in the browser | Conversions API |
|---|---|---|---|
| No consent check | Klaro off, Require Cookie Consent off | Loads immediately on every page | Sends immediately |
| Own cookie check | Klaro off, Require Cookie Consent on | Only with a recognised consent cookie, otherwise nothing is output | Only with a recognised consent cookie |
| Klaro | Use Klaro Consent Manager on | Scripts are delivered blocked and released by Klaro | Only if the Klaro cookie contains consent for the service |
Privacy: The mode "No consent check" is the default: The pixel loads without consent, and Meta receives data from the first page view on. For visitors in the EU, choose one of the other two modes.
Own cookie check
With Require Cookie Consent, the server checks whether consent exists while rendering the page. Without consent, the plugin outputs no pixel script. The check runs server-side on every page request, so consent given takes effect from the next page that is loaded.
Consent is assumed when one of the following conditions is met:
| Cookie | Counts as consent when |
|---|---|
fb_consent |
the value is 1, true, yes, accepted or allow |
CookieConsent |
the value is 1, true, yes, accepted or allow |
CookieControl |
the value is 1, true, yes, accepted or allow |
cookie-agreed |
the value is 1, true, yes, accepted or allow |
cookie-preference |
the content is a JSON object with "marketing": true |
Upper and lower case and whitespace around the values do not matter. All other values, including false or maybe, count as no consent. If your consent solution sets none of these cookies, you can configure it to set fb_consent=1.
Klaro integration
The prerequisite is the MmdKlaroConsent plugin.
- Install and configure the MmdKlaroConsent plugin
- Activate Facebook Pixel, which creates the Klaro service (see below)
- Switch on Use Klaro Consent Manager in the configuration
- Check the Klaro Service Name. It has to match the service in MmdKlaroConsent (default
facebook-pixel).
With the Klaro integration active, the plugin outputs the pixel script as <script type="text/plain" data-type="text/javascript" data-name="...">, with the service name in the data-name attribute. Klaro runs the script only after consent. This applies to the base code including PageView and to all event scripts.
For the Conversions API, the plugin reads the klaro cookie on the server. It must be a JSON object in which the service name has the value true. If the cookie or the entry is missing, the Conversions API sends nothing.
With the Klaro integration active, Require Cookie Consent is not evaluated. Only Klaro and the
klarocookie decide.
Privacy: The fallback for browsers without JavaScript (the
noscriptimage fromfacebook.com) is also output in Klaro mode. Without JavaScript, Klaro cannot ask for consent, so such a browser requests the image without consent.
The Klaro service
On activation of the plugin and in its migration, the plugin creates a cookie service, provided the MmdKlaroConsent table exists and no service with the technical name facebook-pixel exists yet. If MmdKlaroConsent was installed after Facebook Pixel, the service is created when you activate the plugin again.
| Property | Value |
|---|---|
| Technical name | facebook-pixel |
| Purpose | marketing |
| Required / enabled by default | no / no |
| Cookies | _fbp, _fbc (path /) and fr (domain .facebook.com) |
| Position | 20 |
| Assignment | all storefront sales channels |
| Title | Facebook Pixel (DE and EN) |
| Description DE | Ermöglicht die Messung und Optimierung von Facebook-Werbekampagnen. Facebook sammelt Daten über Ihre Interaktion mit unserer Website. |
| Description EN | Enables measurement and optimization of Facebook advertising campaigns. Facebook collects data about your interaction with our website. |
The automatically created service is always named
facebook-pixel. If you change the Klaro Service Name setting, you have to create a service with the new name in MmdKlaroConsent yourself.
Cookies from Meta
The plugin itself sets no cookies. The Meta script creates the cookies _fbp and _fbc in the browser, among others. The Conversions API reads them when present and passes them on to Meta to match events, see Privacy.