Files
lms-sb/src/components/student/gate-view-tracker.tsx
T
adminsandClaude Opus 4.8 0e67a53122 Add Яндекс.Метрика funnel goals: signup_free + gate_view (env-driven counter)
- window.ym reachGoal 'signup_free' on registration success
- GateViewTracker client component fires 'gate_view' on tripwire gate mount
- counter id via NEXT_PUBLIC_METRIKA_COUNTER_ID (build-time)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 12:13:32 +05:00

21 lines
554 B
TypeScript

"use client";
import { useEffect } from "react";
declare global {
interface Window {
ym?: (counterId: number, action: string, goal: string) => void;
}
}
// Фиксирует показ gate-лестницы в Яндекс.Метрике (цель gate_view).
export function GateViewTracker() {
useEffect(() => {
const c = Number(process.env.NEXT_PUBLIC_METRIKA_COUNTER_ID);
if (c && typeof window !== "undefined" && typeof window.ym === "function") {
window.ym(c, "reachGoal", "gate_view");
}
}, []);
return null;
}