社区插件
在 GitHub 上查看插件gatsby-plugin-posthog-analytics
一个简单的 gatsby 插件,用于为您的网站添加 posthog 分析。自动跟踪所有页面浏览量和点击量。
安装
yarn add gatsby-plugin-posthog-analytics
或
npm install --save gatsby-plugin-posthog-analytics
如何使用
// In your gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-posthog-analytics`,
options: {
// Specify the API key for your Posthog Project (required)
apiKey: "YOUR_POSTHOG_ANALYTICS_API_KEY",
// Specify the app host if self-hosting (optional, default: https://app.posthog.com)
appHost: "YOUR_POSTHOG_APP_HOST_URL",
// Puts tracking script in the head instead of the body (optional, default: true)
head: true,
// Enable posthog analytics tracking during development (optional, default: false)
isEnabledDevMode: true
},
},
],
}