mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-16 10:02:30 +03:00
886d30cf9e
* 🚚 move june analytics to folder and update paths * ✨ set up google analytics * ✨ sent firt GA event with react-ga * 🔒️ update security headers to include vercel and google analytics * 🚚 rename Vercel Analytics * ✨ use react-ga4 instread * 💚 fix tests
30 lines
731 B
TypeScript
30 lines
731 B
TypeScript
"use client";
|
|
import { AnalyticsBrowser } from "@june-so/analytics-next";
|
|
import { useEffect, useState } from "react";
|
|
|
|
const juneApiKey = process.env.NEXT_PUBLIC_JUNE_API_KEY;
|
|
|
|
export const useJune = (): AnalyticsBrowser | undefined => {
|
|
const [analytics, setAnalytics] = useState<AnalyticsBrowser | undefined>(
|
|
undefined
|
|
);
|
|
|
|
useEffect(() => {
|
|
const loadAnalytics = () => {
|
|
if (juneApiKey === undefined) {
|
|
console.log("No June API key found");
|
|
|
|
return;
|
|
}
|
|
const response = AnalyticsBrowser.load({
|
|
writeKey: juneApiKey,
|
|
});
|
|
console.log("Loaded June Analytics", response);
|
|
setAnalytics(response);
|
|
};
|
|
loadAnalytics();
|
|
}, []);
|
|
|
|
return analytics;
|
|
};
|