@devgateway/dvz-ui-react
Version:
A modular, embeddable React component library for data visualization and UI, built with TypeScript. Provides reusable components for charts, maps, dashboards, and more, with built-in support for internationalization and Redux integration.
22 lines (21 loc) • 740 B
JavaScript
import { jsx as m } from "react/jsx-runtime";
import p, { useEffect as s } from "react";
import i from "react-ga4";
import { useLocation as f } from "react-router";
import { Config as C } from "../conf/index.js";
import { SettingsContext as g } from "@devgateway/wp-react-lib";
const O = (r, l = {}) => (a) => {
var n;
const o = p.useContext(g) ?? {}, t = ((n = o == null ? void 0 : o.data) == null ? void 0 : n.google_analytics_code) ?? C.GA_CODE;
console.log("gaCode", t);
const e = f();
return i.initialize(t ?? "#REACT_APP_GA_CODE#"), s(() => {
if (t) {
const c = e.pathname;
i.send({ hitType: "pageview", page: c });
}
}, [e.pathname]), /* @__PURE__ */ m(r, { ...a });
};
export {
O as withTracker
};