add lead goal to fb
This commit is contained in:
parent
a6b453181f
commit
4e3150ef3c
@ -2,6 +2,7 @@ import { useExperiments } from "yandex-metrica-ab-react";
|
|||||||
|
|
||||||
export enum EGoals {
|
export enum EGoals {
|
||||||
ENTERED_EMAIL = "EnteredEmail",
|
ENTERED_EMAIL = "EnteredEmail",
|
||||||
|
LEAD = "Lead",
|
||||||
PAYMENT_SUCCESS = "PaymentSuccess",
|
PAYMENT_SUCCESS = "PaymentSuccess",
|
||||||
PURCHASE = "Purchase",
|
PURCHASE = "Purchase",
|
||||||
ROSE_VIDEO_CREATION_START = 'RoseVideoCreationStart',
|
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 (usingMetrics.includes(EMetrics.KLAVIYO)) window.klaviyo.push(['track', goal]);
|
||||||
|
|
||||||
if (!window.fbq) return console.error("Facebook.Metric not found");
|
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);
|
if (usingMetrics.includes(EMetrics.FACEBOOK)) window.fbq('track', goal, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user