eb711fbf1a
Build and Deploy / build (push) Has been cancelled
- Email capture popup with scroll (10%) and exit intent triggers - First name field and full tracking (UTM, device, time on page) - Mautic API integration for contact creation - GeoIP detection for country/region - 4 locale support (sr, en, de, fr) - Mautic tracking script in layout
22 lines
500 B
TypeScript
22 lines
500 B
TypeScript
"use client";
|
|
|
|
import { useEffect, useState } from "react";
|
|
|
|
export function useExitIntent(): boolean {
|
|
const [showExitIntent, setShowExitIntent] = useState(false);
|
|
|
|
useEffect(() => {
|
|
const handleMouseLeave = (e: MouseEvent) => {
|
|
if (e.clientY <= 0) {
|
|
setShowExitIntent(true);
|
|
}
|
|
};
|
|
|
|
document.addEventListener("mouseleave", handleMouseLeave);
|
|
|
|
return () => document.removeEventListener("mouseleave", handleMouseLeave);
|
|
}, []);
|
|
|
|
return showExitIntent;
|
|
}
|