Skip to content

Conversation

@BC-AdamWard
Copy link
Contributor

@BC-AdamWard BC-AdamWard commented Nov 19, 2025

What/Why?

Add Meta Pixel (Facebook Pixel) analytics provider to Catalyst analytics framework. Implements standard e-commerce event tracking (ViewContent, AddToCart, RemoveFromCart, ViewCart, ViewCategory) with consent management support. Enables merchants to track events using Meta Pixel alongside or instead of Google Analytics.

  • Add MetaPixelProvider class implementing AnalyticsProvider interface
  • Update WebAnalyticsFragment to include metaPixel configuration
  • Update AnalyticsProvider component to support multiple providers
  • Add consent management integration for GDPR/CCPA compliance

Testing

  1. Add Meta Pixel to store settings or inline in the Catalyst component.
  2. Load storefront and validate pixel fires against meta pixel

Migration

Minor change

Add Meta Pixel (Facebook Pixel) analytics provider to Catalyst analytics
framework. Implements standard e-commerce event tracking (ViewContent,
AddToCart, RemoveFromCart, ViewCart, ViewCategory) with consent management
support. Enables merchants to track events using Meta Pixel alongside or
instead of Google Analytics.

- Add MetaPixelProvider class implementing AnalyticsProvider interface
- Update WebAnalyticsFragment to include metaPixel configuration
- Update AnalyticsProvider component to support multiple providers
- Add consent management integration for GDPR/CCPA compliance
@changeset-bot
Copy link

changeset-bot bot commented Nov 19, 2025

🦋 Changeset detected

Latest commit: 0d7b568

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst-core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Nov 19, 2025

@BC-AdamWard is attempting to deploy a commit to the BigCommerce Platform Team on Vercel.

A member of the Team first needs to authorize it.

@BC-AdamWard BC-AdamWard marked this pull request as ready for review November 19, 2025 04:52
@BC-AdamWard BC-AdamWard requested a review from a team as a code owner November 19, 2025 04:52
Copy link
Contributor

@chanceaclark chanceaclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love how simple this add was! Wonder who set this up to be easy... 😏

Have a few comments specific to the provider + some type stuff otherwise looking good.

Comment on lines +7 to +8
getConsent?: () => Analytics.Consent.ConsentValues | null;
debugMode?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two properties are based on how the analytics providers manages consent and if it has a debug option.

For the consent piece, do you know if MP handles managing consent on it's own, like GA does? Or does it always assume you have consent when placed on the page?

s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '${this.config.pixelId}');
${this.config.debugMode ? "fbq('track', 'PageView');" : ''}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this manually added or do they have an example with debugMode?

Comment on lines +142 to +143
if (typeof window !== 'undefined' && (window as any).fbq) {
(window as any).fbq('consent', 'revoke');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any should be avoided here and anywhere else in the file. Would also love to see if they have a type library we can use so we don't have to type check this, see @types/gtag.js.

Suggested change
if (typeof window !== 'undefined' && (window as any).fbq) {
(window as any).fbq('consent', 'revoke');
if (typeof window !== 'undefined' && 'fbq' in window) {
window.fbq('consent', 'revoke');

Comment on lines +57 to +67
// Check consent before initializing
if (this.config.consentModeEnabled && this.config.getConsent) {
const consent = this.config.getConsent();
if (consent && !consent.marketing) {
// Consent denied, don't initialize pixel
if (this.config.debugMode) {
console.log('[Meta Pixel] Consent denied, pixel not initialized');
}
return;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably move this logic into the initializeConsent function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants