add lead goal to fb

This commit is contained in:
dev.daminik00 2024-08-12 10:38:59 +02:00
parent a6b453181f
commit 4e3150ef3c

View File

@ -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);
}