# How to set up the Meta Pixel with Cookiequiet

> Two ways to keep the Meta Pixel from firing before consent: mark its base code with type="text/plain" and data-cq-category="marketing" so Cookiequiet runs it only after the visitor accepts marketing, or load it from Google Tag Manager on the cq_consent event when cq_marketing is true. Meta has no Consent Mode; its own fbq('consent', 'revoke') and fbq('consent', 'grant') calls are the fallback for pixels a platform loads for you.

Source: https://cookiequiet.com/platforms/meta-pixel
Published: 2026-10-20
Publisher: Cookiequiet

## Steps

1. **Get the base code** In Meta Events Manager, open your pixel and copy the base code: a script that loads fbevents.js, calls fbq('init') with your pixel ID and fbq('track', 'PageView'), plus a noscript image.
2. **Mark the base code** Paste the script below the Cookiequiet snippet in the head of every page and change its opening tag to type="text/plain" with data-cq-category="marketing". Leave the code inside unchanged.
3. **Remove the noscript image** Delete the noscript block. It is a plain image request that would record a page view without JavaScript, before any consent, and Cookiequiet cannot hold an image.
4. **Mark event calls too** Standard events such as fbq('track', 'Purchase') placed in page code must sit in scripts marked the same way, or run only after checking that window.Cookiequiet.get() includes marketing.
5. **Or fire it from Google Tag Manager** In Tag Manager, use the Meta Pixel tag with a Custom Event trigger on cq_consent where cq_marketing equals true, firing once per page, and add Require additional consent for tag to fire with ad_storage on the event tags.
6. **Pixels loaded by your platform** If Shopify, Wix, Squarespace or HubSpot loads the pixel for you, follow the platform guide: Shopify and HubSpot take the choice through their consent APIs; elsewhere, paste the pixel yourself or call fbq('consent', 'revoke') before init and fbq('consent', 'grant') after consent.
7. **Test with Reject all** In a private window, click Reject all and check that no _fbp cookie is set and no request goes to connect.facebook.net. Accept all, reload: the Meta Pixel Helper shows a PageView and _fbp appears.

## Option 1: mark the base code

Meta recommends placing the pixel base code in the head of every page. With Cookiequiet, paste it right below the snippet and change only the opening tag:

```html
<script type="text/plain" data-cq-category="marketing">
  /* the base code from Events Manager, unchanged: it loads fbevents.js, then */
  fbq('init', 'YOUR_PIXEL_ID');
  fbq('track', 'PageView');
</script>
```

Cookiequiet runs the script when the marketing category is granted: immediately on later visits where the stored choice includes it, and at the moment of the click when the visitor accepts during the visit. Until then, nothing is loaded from `connect.facebook.net` and no `_fbp` cookie is set. Tags marked `data-cookiecategory="marketing"` or `data-cookieconsent="marketing"` for CookieYes or Cookiebot work as they are; see [switching from CookieYes](/guides/switch-from-cookieyes).

**Remove the noscript image.** The base code ends with a `<noscript>` block containing a 1x1 image that requests Meta's servers with your pixel ID. It is plain HTML: it fires in browsers with JavaScript disabled, before any banner, and no consent script can hold an image. Delete it.

**Events.** Standard events in page code (`fbq('track', 'Purchase', ...)`) must not run before the pixel: put them in scripts marked the same way, or, in your own JavaScript, check that `window.Cookiequiet.get()` returns a choice whose `c` array includes `marketing` before calling `fbq`.

## Option 2: fire it from Google Tag Manager

In Tag Manager, use the Meta Pixel tag (Meta's template from the community gallery, or a Custom HTML tag with the base code) and give it a **Custom Event** trigger: event name `cq_consent`, **Some Custom Events**, condition `cq_marketing equals true`, with **Tag firing options** set to **Once per page**. Cookiequiet pushes `cq_consent` with the `cq_marketing` flag on every page load where a choice is stored and after each choice. For event tags that fire on form submissions or purchases, add **Require additional consent for tag to fire** with `ad_storage` under **Advanced Settings**, then **Consent Settings**: Cookiequiet sets `ad_storage` granted with the marketing category, so the check holds. The [Tag Manager guide](/platforms/google-tag-manager) describes the variables and triggers in detail.

## Option 3: Meta's consent calls

Meta's pixel has its own consent switch for sites where the pixel loads before the banner: `fbq('consent', 'revoke')` pauses the pixel, `fbq('consent', 'grant')` resumes it. Meta documents that revoke must be called on every page, before `fbq('init')`. It is the fallback when a platform loads the pixel for you and gives you no consent API. Place the revoke call before the base code, and grant on consent with the event Cookiequiet dispatches:

```html
<script>
  window.addEventListener('cq:consent', function (e) {
    if (typeof fbq === 'function' && e.detail.categories.indexOf('marketing') >= 0) {
      fbq('consent', 'grant');
    }
  });
</script>
```

Note the difference with option 1: the pixel script is loaded and `fbevents.js` runs; only its sending is paused. Where you can mark the base code, marking is the cleaner choice.

## Pixels loaded by your platform

- **Shopify**: the Facebook & Instagram app installs the pixel as an app pixel, which follows Shopify's Customer Privacy API; the [Shopify guide](/platforms/shopify) shows the bridge that passes Cookiequiet's choice to it.
- **HubSpot**: a pixel added through HubSpot's ads tool follows the advertisement value passed with `setHubSpotConsent`, see the [HubSpot guide](/platforms/hubspot-cms).
- **Wix and Squarespace**: the pixel ID fields of these platforms load the pixel outside your control. Remove the ID and paste the marked base code through custom code, as the [Wix](/platforms/wix) and [Squarespace](/platforms/squarespace) guides explain.
- **Plugins and tag managers** that inject `fbevents.js` with JavaScript are held by the auto-blocker, which lists `connect.facebook.net` under marketing, until that category is granted.

## How to test

1. Install the Meta Pixel Helper extension, open the site in a private window and click **Reject all**: the helper finds no pixel, the network tab shows no request to `connect.facebook.net` or `facebook.com/tr`, and there is no `_fbp` cookie.
2. Clear the cookies, click **Accept all**, reload: the helper shows the PageView event and `_fbp` is set.
3. Complete a test conversion and check that the event appears in Events Manager's test events.
4. Open the consent log in the Cookiequiet dashboard.

## Details worth knowing

- **Cookies.** The pixel sets `_fbp` (a browser identifier, 90 days) and, after a click on a Meta ad, `_fbc`. Both are marketing cookies in the banner's cookie table.
- **Conversions API.** Sending the same events from your server does not remove the need for consent; the server events must follow the same choice, which the consent log documents.
- **Advanced matching** sends hashed customer data with the events and is part of the pixel's marketing purpose.
- **Consent rates.** Expect pixel data to cover the share of visitors who accept marketing; the article on [consent rates](/blog/cookie-consent-rates-what-to-expect) gives orders of magnitude.

## Questions

### Does the Meta Pixel support Google's Consent Mode?

No. Consent Mode is a Google mechanism. For the Meta Pixel you either keep it from loading until consent (marking or a cq_consent trigger in Tag Manager), or use Meta's own fbq('consent', 'revoke') and fbq('consent', 'grant') calls.

### Which category does the Meta Pixel belong to?

Marketing. It identifies visitors across sites for advertising measurement and audiences, which is the definition of that category in the banner.

### Why is _fbp still set after Reject all?

Three usual causes: the noscript image was left in the page, the base code sits above the Cookiequiet snippet without marking, or a platform integration loads the pixel outside your code. Remove the image, move and mark the code, or follow the platform guide.

### Do I need consent for the Conversions API as well?

Yes. Server-side events describe the same visitor; sending them without the marketing consent recorded for that visitor is the same processing by another route. Use the consent log to decide which events to send.

## Sources

- [Meta for Developers: Get started with the Meta Pixel](https://developers.facebook.com/docs/meta-pixel/get-started)
- [Meta for Developers: Meta Pixel and GDPR (consent grant and revoke)](https://developers.facebook.com/docs/meta-pixel/implementation/gdpr)
- [Google Tag Manager Help: Custom event trigger](https://support.google.com/tagmanager/answer/7679219)
- [Google Tag Manager Help: Consent mode in Tag Manager](https://support.google.com/tagmanager/answer/10718549)
