pixel: add ensure fbc fallback

This commit is contained in:
Elijah Duffy
2025-12-18 19:22:54 -08:00
parent f2d389ee64
commit 0cd3f10da6
5 changed files with 114 additions and 7 deletions

View File

@@ -1,3 +1,4 @@
import { getFbpFbc } from '../metapixel/fbc.ts';
import type { TrackingManager } from '$lib/tracking.svelte';
import type {
ConversionErrorResponseBody,
@@ -42,13 +43,12 @@ export class ConversionClient {
}
): Promise<ConversionResponseBody | ConversionErrorResponseBody> {
// Extract user data
const fbp = await cookieStore.get('_fbp');
const fbc = await cookieStore.get('_fbc');
const { fbp, fbc } = getFbpFbc();
const user: ConversionUserData = {
...options.user,
fbp: fbp?.value,
fbc: fbc?.value
fbp,
fbc
};
// Get event source URL & extract UTM params if present