@@ -36,6 +36,7 @@ export interface SeoOptions {
3636
3737export interface AnalyticsOptions {
3838 googleTagId ?: string ;
39+ facebookPixelId ?: string ;
3940}
4041
4142export interface CustomHtmlOptions {
@@ -160,9 +161,10 @@ ${slugs
160161
161162 /*
162163 * Step 3.5: analytics configuration (optional)
163- * Add your Google Analytics 4 Measurement ID for built-in tracking
164+ * Add your Google Analytics 4 Measurement ID and/or Facebook Pixel ID for built-in tracking
164165 */
165166 const GOOGLE_TAG_ID = '${ analytics ?. googleTagId || "" } ';
167+ const FACEBOOK_PIXEL_ID = '${ analytics ?. facebookPixelId || "" } ';
166168
167169 /*
168170 * Step 3.6: custom HTML header injection (optional)
565567 </script>\`, { html: true });
566568 }
567569
570+ // Add Facebook Pixel if configured (Issue #31)
571+ if (FACEBOOK_PIXEL_ID !== '') {
572+ element.append(\`<script>
573+ !function(f,b,e,v,n,t,s)
574+ {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
575+ n.callMethod.apply(n,arguments):n.queue.push(arguments)};
576+ if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
577+ n.queue=[];t=b.createElement(e);t.async=!0;
578+ t.src=v;s=b.getElementsByTagName(e)[0];
579+ s.parentNode.insertBefore(t,s)}(window, document,'script',
580+ 'https://connect.facebook.net/en_US/fbevents.js');
581+ fbq('init', '\${FACEBOOK_PIXEL_ID}');
582+ fbq('track', 'PageView');
583+ </script>
584+ <noscript><img height="1" width="1" style="display:none"
585+ src="https://www.facebook.com/tr?id=\${FACEBOOK_PIXEL_ID}&ev=PageView&noscript=1"
586+ /></noscript>\`, { html: true });
587+ }
588+
568589 // Add Twitter/X meta tags for social cards (Issue #19)
569590 if (TWITTER_HANDLE !== '') {
570591 element.append(\`<meta name="twitter:site" content="\${TWITTER_HANDLE}">\`, { html: true });
0 commit comments