2
0

🐛 (pixel) Fix multiple Meta pixels tracking

Closes #846
This commit is contained in:
Baptiste Arnaud
2023-09-26 10:22:02 +02:00
parent a176e23cc8
commit 56e175bda6
4 changed files with 22 additions and 18 deletions

View File

@@ -2,7 +2,11 @@
import { initGoogleAnalytics } from '@/lib/gtag'
import { gtmBodyElement } from '@/lib/gtm'
import { initPixel } from '@/lib/pixel'
import { injectCustomHeadCode, isNotEmpty } from '@typebot.io/lib/utils'
import {
injectCustomHeadCode,
isDefined,
isNotEmpty,
} from '@typebot.io/lib/utils'
import { StartPropsToInject } from '@typebot.io/schemas'
export const injectStartProps = async (
@@ -15,6 +19,8 @@ export const injectStartProps = async (
const googleAnalyticsId = startPropsToInject.googleAnalyticsId
if (isNotEmpty(googleAnalyticsId))
await initGoogleAnalytics(googleAnalyticsId)
const pixelId = startPropsToInject.pixelId
if (isNotEmpty(pixelId)) initPixel(pixelId)
const pixelIds = startPropsToInject.pixelId
? [startPropsToInject.pixelId]
: startPropsToInject.pixelIds
if (isDefined(pixelIds)) initPixel(pixelIds)
}