From 4e3150ef3c5c4df16e26d9c364a284b0a4e443cb Mon Sep 17 00:00:00 2001 From: "dev.daminik00" Date: Mon, 12 Aug 2024 10:38:59 +0200 Subject: [PATCH] add lead goal to fb --- src/services/metric/metricService.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/services/metric/metricService.ts b/src/services/metric/metricService.ts index 688f4cb..bd60863 100644 --- a/src/services/metric/metricService.ts +++ b/src/services/metric/metricService.ts @@ -2,6 +2,7 @@ import { useExperiments } from "yandex-metrica-ab-react"; export enum EGoals { ENTERED_EMAIL = "EnteredEmail", + LEAD = "Lead", PAYMENT_SUCCESS = "PaymentSuccess", PURCHASE = "Purchase", ROSE_VIDEO_CREATION_START = 'RoseVideoCreationStart', @@ -83,6 +84,11 @@ const reachGoal = (goal: EGoals, usingMetrics = [EMetrics.KLAVIYO, EMetrics.YAND if (usingMetrics.includes(EMetrics.KLAVIYO)) window.klaviyo.push(['track', goal]); if (!window.fbq) return console.error("Facebook.Metric not found"); + + if (goal === EGoals.ENTERED_EMAIL) { + if (usingMetrics.includes(EMetrics.FACEBOOK)) window.fbq('track', EGoals.LEAD, options); + } + if (usingMetrics.includes(EMetrics.FACEBOOK)) window.fbq('track', goal, options); }