Merge branch 'hotfix/lead' into 'main'

add lead goal to fb

See merge request witapp/aura-webapp!297
This commit is contained in:
Daniil Chemerkin 2024-08-12 08:40:24 +00:00
commit da704b29df

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