dumi-theme-lobehub
Version:
dumi-theme-lobehub is a documentation site theme package designed for dumi2. It provides a more beautiful and user-friendly development and reading experience based on @lobehub/ui
32 lines • 2.01 kB
JavaScript
import { Helmet } from 'dumi';
import { siteSelectors, useSiteStore } from "../../../store";
import { jsx as _jsx } from "react/jsx-runtime";
import { Fragment as _Fragment } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var Analytics = function Analytics() {
var analytics = useSiteStore(siteSelectors.analytics);
return /*#__PURE__*/_jsxs(Helmet, {
children: [(analytics === null || analytics === void 0 ? void 0 : analytics.googleAnalytics) && /*#__PURE__*/_jsxs(_Fragment, {
children: [/*#__PURE__*/_jsx("script", {
async: true,
src: "https://www.googletagmanager.com/gtag/js?id=".concat(analytics.googleAnalytics.measurementId)
}), /*#__PURE__*/_jsx("script", {
dangerouslySetInnerHTML: {
__html: "\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', '".concat(analytics.googleAnalytics.measurementId, "');\n")
},
id: "google-analytics",
type: "text/javascript"
})]
}), (analytics === null || analytics === void 0 ? void 0 : analytics.clarity) && /*#__PURE__*/_jsx("script", {
dangerouslySetInnerHTML: {
__html: "\n (function(c,l,a,r,i,t,y){\n c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};\n t=l.createElement(r);t.async=1;t.src=\"https://www.clarity.ms/tag/\"+i;\n y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);\n })(window, document, \"clarity\", \"script\", \"".concat(analytics.clarity.projectId, "\");\n ")
},
id: "microsoft-clarity-init"
}), (analytics === null || analytics === void 0 ? void 0 : analytics.plausible) && /*#__PURE__*/_jsx("script", {
"data-domain": analytics.plausible.domain,
defer: true,
src: "".concat(analytics.plausible.scriptBaseUrl, "/js/script.js")
})]
});
};
export default Analytics;