chore: add ga & hotjar (#38591)

* chore: add ga & horjar

* chore: code clean
This commit is contained in:
MadCcc 2022-11-16 14:07:57 +08:00 committed by GitHub
parent 75a38c5805
commit e9ab28d4a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,10 @@ export default defineConfig({
extraRehypePlugins: [rehypeAntd],
extraBabelPresets: ['@emotion/babel-preset-css-prop'],
mfsu: false,
metas: [{ name: 'theme-color', content: '#1677ff' }],
analytics: {
ga_v2: 'UA-72788897-1',
},
headScripts: [
`
(function () {
@ -91,5 +95,25 @@ export default defineConfig({
document.documentElement.className += isZhCN(pathname) ? 'zh-cn' : 'en-us';
})();
`,
// Hotjar Tracking Code for ant.design
`
(function (h, o, t, j, a, r) {
if (location.hostname === 'localhost') {
return;
}
h.hj =
h.hj ||
function () {
(h.hj.q = h.hj.q || []).push(arguments);
};
h._hjSettings = { hjid: 473408, hjsv: 5 };
a = o.getElementsByTagName('head')[0];
r = o.createElement('script');
r.async = 1;
r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv;
a.appendChild(r);
})(window, document, '//static.hotjar.com/c/hotjar-', '.js?sv=');
`,
],
});