A facebook pixel module for Svelte / SvelteKit
The Svelte Facebook Pixel Component is a tracking component for Svelte v3 that allows users to implement Facebook pixel tracking on their website. It provides an easy way to track events and pageviews with Facebook pixels.
To install the Svelte Facebook Pixel Component, follow these steps:
npm install svelte-facebook-pixel-component
import FacebookPixel from 'svelte-facebook-pixel-component';
let pixel = new FacebookPixel({
pixelId: 'YOUR_PIXEL_ID',
enabled: true
});
start method to start the pixel and track the current page:<script>
import { onMount } from 'svelte';
onMount(() => {
pixel.start();
pixel.track('PageView');
});
</script>
The Svelte Facebook Pixel Component is a useful tool for implementing Facebook pixel tracking in Svelte v3 projects. It allows for easy tracking of events and pageviews with the ability to have multiple pixels on a page. It also provides options to disable the pixel for GDPR compliance. The component is easy to install and use, making it a valuable addition to any Svelte project.