bnomei / kirby3-posthog
Kirby 3 wrapper for Posthog
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:kirby-plugin
Requires
- php: >=7.4.0
- getkirby/composer-installer: ^1.2
- posthog/posthog-php: ^2.1
README
Kirby 3 Plugin for connecting Kirby to Posthog
Install
Using composer:
composer require bnomei/kirby3-posthog
Using git submodules:
git submodule add https://github.com/bnomei/kirby3-posthog.git site/plugins/kirby3-posthog
Using download & copy: download the latest release and copy to site/plugins
Commerical Usage
Support open source!
This plugin is free but if you use it in a commercial project please consider to sponsor me or make a donation.
If my work helped you to make some cash it seems fair to me that I might get a little reward as well, right?
Be kind. Share a little. Thanks.
‐ Bruno
M | O | N | E | Y |
---|---|---|---|---|
Github sponsor | Patreon | Buy Me a Coffee | Paypal dontation | Hire me |
Setup
You can set the apikey and host in the config.
site/config/config.php
return [ // other config settings ... 'bnomei.posthog.apikey' => 'YOUR-KEY-HERE', 'bnomei.posthog.host' => 'YOUR-HOST-HERE', ];
You can also set a callback if you use the dotenv Plugin.
site/config/config.php
return [ // other config settings ... 'bnomei.posthog.apikey' => function() { return env('POSTHOG_APIKEY'); }, 'bnomei.posthog.host' => function() { return env('POSTHOG_HOST'); }, ];
Usage
Javascript
Output the tracking Javascript via the snippet included in the plugin.
<?php snippet('posthog'); ?> </body> </html>
PHP
Use the posthog()
-helper to access Posthog. You can use all methods from the Posthog PHP library.
posthog()->capture([ // your capture data ])
Additional Features
In addition to the posthog()
-helper this plugin adds the following features to the original library.
- Disabled on localhost by default
- Cache for Feature Flags - it would send a http request every time you access one otherwise.
Settings
bnomei.posthog. | Default | Description |
---|---|---|
apikey | string or callback |
|
host | string or callback |
|
enabled | true or false or 'force' |
but disabled on localhost setups by default |
featureflags | 1 |
duration (in minutes) to cache the feature flags in minutes |
Dependencies
Disclaimer
This 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.
License
It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.