{"id":15741819,"url":"https://github.com/bnomei/kirby3-posthog","last_synced_at":"2025-07-18T23:07:26.081Z","repository":{"id":62495619,"uuid":"472369553","full_name":"bnomei/kirby3-posthog","owner":"bnomei","description":"Connect Kirby to Posthog","archived":false,"fork":false,"pushed_at":"2025-01-09T16:06:28.000Z","size":124,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-03T13:55:49.021Z","etag":null,"topics":["analytics","kirby","kirby-cms","kirby-plugin","kirby3","kirby4","kirby5","posthog","self-hosted"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bnomei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-21T14:17:06.000Z","updated_at":"2025-01-13T13:12:04.000Z","dependencies_parsed_at":"2024-12-09T19:19:29.948Z","dependency_job_id":"42d1692e-e788-4954-809d-cd2dabc3245c","html_url":"https://github.com/bnomei/kirby3-posthog","commit_stats":{"total_commits":25,"total_committers":2,"mean_commits":12.5,"dds":"0.16000000000000003","last_synced_commit":"9691eefd10491edba70626775588e81542cde851"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/bnomei/kirby3-posthog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnomei%2Fkirby3-posthog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnomei%2Fkirby3-posthog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnomei%2Fkirby3-posthog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnomei%2Fkirby3-posthog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bnomei","download_url":"https://codeload.github.com/bnomei/kirby3-posthog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnomei%2Fkirby3-posthog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265849011,"owners_count":23838195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","kirby","kirby-cms","kirby-plugin","kirby3","kirby4","kirby5","posthog","self-hosted"],"created_at":"2024-10-04T03:00:42.804Z","updated_at":"2025-07-18T23:07:26.061Z","avatar_url":"https://github.com/bnomei.png","language":"PHP","funding_links":["https://www.buymeacoffee.com/bnomei"],"categories":[],"sub_categories":[],"readme":"# Kirby Posthog\n\n![Release](https://flat.badgen.net/packagist/v/bnomei/kirby3-posthog?color=ae81ff\u0026icon=github\u0026label)\n[![Discord](https://flat.badgen.net/badge/discord/bnomei?color=7289da\u0026icon=discord\u0026label)](https://discordapp.com/users/bnomei)\n[![Buymecoffee](https://flat.badgen.net/badge/icon/donate?icon=buymeacoffee\u0026color=FF813F\u0026label)](https://www.buymeacoffee.com/bnomei)\n\nKirby Plugin for interfacing with [Posthog](https://posthog.com/)\n\n## Install\n\n- unzip [master.zip](https://github.com/bnomei/kirby3-posthog/archive/master.zip) as folder `site/plugins/kirby3-posthog` or\n- `git submodule add https://github.com/bnomei/kirby3-posthog.git site/plugins/kirby3-posthog` or\n- `composer require bnomei/kirby3-posthog`\n\n## Setup\n\nYou can set the apikey and host in the config.\n\n**site/config/config.php**\n```php\nreturn [\n    // other config settings ...\n    'bnomei.posthog.apikey' =\u003e 'YOUR-KEY-HERE',\n    'bnomei.posthog.host' =\u003e 'YOUR-HOST-HERE',\n];\n```\n\nYou can also set a callback if you use the [dotenv Plugin](https://github.com/bnomei/kirby3-dotenv).\n\n**site/config/config.php**\n```php\nreturn [\n    // other config settings ...\n    'bnomei.posthog.apikey' =\u003e function() { return env('POSTHOG_APIKEY'); },\n    'bnomei.posthog.host' =\u003e function() { return env('POSTHOG_HOST'); },\n];\n```\n\n### Javascript\n\nOutput the tracking Javascript via the snippet included in the plugin.\n\n```php\n  \u003c?php snippet('posthog'); ?\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Usage\n\n### PHP track pageview\n\n**site/template/default.php**\n```php\n\u003c?php\n// track page view event for current kirby user or identified posthog user\n$page-\u003eposthogCapturePageView();\n\n// be careful to not have any whitespace before \u003chtml\u003e\n\u003e\u003chtml\u003e\n    \u003c!-- ... ---\u003e\n\u003c/html\u003e\n```\n\n### PHP helper function\n\nUse the `posthog()`-helper to access Posthog. You can use all methods from the [Posthog PHP library](https://github.com/PostHog/posthog-php).\n\n```php\n\u003c?php\n\nposthog()-\u003ecapture([\n    'distinctId' =\u003e site()-\u003eposthogDistinctId(),\n    'event' =\u003e 'movie played',\n    'properties' =\u003e array(\n        'movieId' =\u003e '123',\n        'category' =\u003e 'romcom'\n    )\n])\n```\n\nIn addition to the `posthog()`-helper this plugin adds the following features to the original library.\n\n- Disabled on localhost by default\n- Cache for Feature Flag list - it would otherwise send a http request to your posthog instance every time you access the list. It still will send one for every feature flag check.\n\n\u003e [!WARNING]\n\u003e Using the static class from the official Posthog docs is not supported.\n\n## Settings\n\n| bnomei.posthog. | Default                   | Description                                                 |\n|-----------------|---------------------------|-------------------------------------------------------------|\n| apikey          | `string or callback`      |                                                             |\n| personalapikey  | `string or callback`      |                                                             |\n| host            | `string or callback`      |                                                             |\n| enabled         | `true or false or 'force'` | but disabled on localhost setups by default                 |\n| featureflags    | `1`                       | duration (in minutes) to cache the feature flags in minutes |\n\n\u003e [!TIP]\n\u003e Read more about `apikey` and `personalapikey` here: https://posthog.com/docs/api\n\n## Dependencies\n\n- [Posthog PHP](https://github.com/PostHog/posthog-php)\n\n## Disclaimer\n\nThis plugin is provided \"as is\" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please [create a new issue](https://github.com/bnomei/kirby3-posthog/issues/new).\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT)\n\nIt is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnomei%2Fkirby3-posthog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbnomei%2Fkirby3-posthog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnomei%2Fkirby3-posthog/lists"}