Gatsby custom head & Google Analytics All In One
Google Analytics(分析)
https://analytics.google.com/analytics/web/#/a248706071p341215062/admin/streams/table/4264481260
添加 Google 代码
您可以使用网站开发工具自动完成设置,也可以手动添加
代码。为了确保衡量结果准确无误,请务必在您网站的每一个网页
上添加代码。
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-K1R7J1JJHW"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-K1R7J1JJHW');
</script>
https://github.com/xgqfrms/cnblogs/actions/runs/3412607515/jobs/5678333804
Customizing html.js
$ cp .cache/default-html.js src/html.js
<script
dangerouslySetInnerHTML={{
__html: `
var name = 'world';
console.log('Hello ' + name);
`,
}}
/>
https://www.gatsbyjs.com/docs/custom-html/
refs
https://github.com/xgqfrms/cnblogs/blob/gh-pages/website/src/pages/index.js
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载
标签:head,Google,js,Analytics,xgqfrms,custom,com From: https://www.cnblogs.com/xgqfrms/p/16868027.html