Merge branch 'AW-106-klaviyo-metric' into 'develop'
AW-106-klaviyo-metric See merge request witapp/aura-webapp!232
This commit is contained in:
commit
b954612a6e
@ -121,7 +121,7 @@ import LoadingPage from "../pages/LoadingPage";
|
|||||||
import { EProductKeys, productUrls } from "@/data/products";
|
import { EProductKeys, productUrls } from "@/data/products";
|
||||||
import SinglePaymentPage from "../pages/SinglePaymentPage";
|
import SinglePaymentPage from "../pages/SinglePaymentPage";
|
||||||
import ABDesignV1Routes from "@/routerComponents/ABDesign/v1";
|
import ABDesignV1Routes from "@/routerComponents/ABDesign/v1";
|
||||||
import metricService from "@/services/metric/metricService";
|
import metricService, {EGoals} from "@/services/metric/metricService";
|
||||||
|
|
||||||
const isProduction = import.meta.env.MODE === "production";
|
const isProduction = import.meta.env.MODE === "production";
|
||||||
|
|
||||||
@ -164,6 +164,11 @@ function App(): JSX.Element {
|
|||||||
const birthPlace = user?.profile?.birthplace || birthPlaceFromStore;
|
const birthPlace = user?.profile?.birthplace || birthPlaceFromStore;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (location.pathname.includes("v1/trial-choice")) {
|
||||||
|
metricService.reachGoal(EGoals.AURA_TRIAL_CHOICE_PAGE_VISIT, true)
|
||||||
|
} else if (location.pathname.includes("v1/trial-payment")) {
|
||||||
|
metricService.reachGoal(EGoals.AURA_TRIAL_PAYMENT_PAGE_VISIT, true)
|
||||||
|
}
|
||||||
metricService.hit()
|
metricService.hit()
|
||||||
}, [location]);
|
}, [location]);
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,9 @@ export enum EGoals {
|
|||||||
ROSE_VIDEO_PLAY_USER_STOP = "RoseVideoPlayUserStop",
|
ROSE_VIDEO_PLAY_USER_STOP = "RoseVideoPlayUserStop",
|
||||||
ROSE_VIDEO_PLAY_USER_PLAY = "RoseVideoPlayUserPlay",
|
ROSE_VIDEO_PLAY_USER_PLAY = "RoseVideoPlayUserPlay",
|
||||||
AURA_PAYMENT_METHODS_OPENED = "AuraPaymentMethodsOpened",
|
AURA_PAYMENT_METHODS_OPENED = "AuraPaymentMethodsOpened",
|
||||||
AURA_SELECT_TRIAL = "AuraSelectTrial"
|
AURA_SELECT_TRIAL = "AuraSelectTrial",
|
||||||
|
AURA_TRIAL_CHOICE_PAGE_VISIT = "AuraTrialChoicePageVisit",
|
||||||
|
AURA_TRIAL_PAYMENT_PAGE_VISIT = "AuraTrialPaymentPageVisit"
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IUserParams {
|
interface IUserParams {
|
||||||
@ -47,14 +49,19 @@ const userParams = (parameters: Partial<IUserParams>) => {
|
|||||||
window.klaviyo.push(['identify', parameters]);
|
window.klaviyo.push(['identify', parameters]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const reachGoal = (goal: EGoals) => {
|
const reachGoal = (goal: EGoals, onlyKlaviyo = false) => {
|
||||||
if (!checkIsAvailableYandexMetric()) return;
|
if (onlyKlaviyo) {
|
||||||
|
if (!window.klaviyo) return console.error("Klaviyo.Metric not found");
|
||||||
|
window.klaviyo.push(['track', goal]);
|
||||||
|
} else {
|
||||||
|
if (!checkIsAvailableYandexMetric()) return;
|
||||||
|
|
||||||
window.ym(metricCounterNumber, "reachGoal", goal)
|
window.ym(metricCounterNumber, "reachGoal", goal)
|
||||||
console.log("goal: ", goal);
|
console.log("goal: ", goal);
|
||||||
|
|
||||||
if (!window.klaviyo) return console.error("Klaviyo.Metric not found");
|
if (!window.klaviyo) return console.error("Klaviyo.Metric not found");
|
||||||
window.klaviyo.push(['track', goal]);
|
window.klaviyo.push(['track', goal]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type THitOptions = {
|
type THitOptions = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user