npm

gatsby-plugin-posthog

1.0.1 • Public • Published

gatsby-plugin-posthog

npm

A simple gatsby plugin to add posthog analytics to your site. Automatically tracks all the pageviews and clicks.

Install

yarn add gatsby-plugin-posthog

or

npm install --save gatsby-plugin-posthog

How to use

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-posthog`,
      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)
        apiHost: "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
        // Pass custom variables to posthog.init() (optional)
        initOptions: {
          // ...
        }
      },
    },
  ],
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.1537latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.1537
1.0.00

Package Sidebar

Install

npm i gatsby-plugin-posthog

Weekly Downloads

466

Version

1.0.1

License

MIT

Unpacked Size

7.76 kB

Total Files

10

Last publish

Collaborators

  • macobo