PHPackages                             kingfisherdirect/magento2-posthog - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kingfisherdirect/magento2-posthog

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

kingfisherdirect/magento2-posthog
=================================

PostHog Analytics integration module for Magento 2

0256↓33.3%PHP

Since Dec 22Pushed 2mo agoCompare

[ Source](https://github.com/kingfisherdirect/magento2-posthog)[ Packagist](https://packagist.org/packages/kingfisherdirect/magento2-posthog)[ RSS](/packages/kingfisherdirect-magento2-posthog/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

KingfisherDirect\_Posthog
=========================

[](#kingfisherdirect_posthog)

PostHog Analytics integration module for Magento 2.

Features
--------

[](#features)

- Global PostHog analytics integration
- Admin panel configuration
- CSP (Content Security Policy) whitelist included
- Store-level configuration support
- Easy to configure for multiple sites

Configuration
-------------

[](#configuration)

Navigate to: **Stores &gt; Configuration &gt; General &gt; PostHog**

### Settings

[](#settings)

- **Enable PostHog:** Yes/No
- **PostHog Project API Key:** Your PostHog project API key (e.g., `phc_...`)
- **API Host:** PostHog API host URL (default: `https://eu.i.posthog.com`)
- **Person Profiles:** When to create person profiles:

    - Always
    - Identified Only (default)
    - Never

Installation
------------

[](#installation)

```
# Enable module
bin/magento module:enable KingfisherDirect_Posthog

# Run setup upgrade
bin/magento setup:upgrade

# Flush cache
bin/magento cache:flush

```

CLI Configuration
-----------------

[](#cli-configuration)

You can configure PostHog via CLI:

```
# Enable PostHog
bin/magento config:set posthog/general/enabled 1

# Set API Key
bin/magento config:set posthog/general/project_api_key "phc_YOUR_KEY_HERE"

# Set API Host
bin/magento config:set posthog/general/api_host "https://eu.i.posthog.com"

# Set Person Profiles
bin/magento config:set posthog/general/person_profiles "identified_only"

# Flush cache
bin/magento cache:flush

```

Multi-site Setup
----------------

[](#multi-site-setup)

For different sites, you can configure different PostHog projects:

```
# For a specific website
bin/magento config:set --scope=websites --scope-code=site1 posthog/general/project_api_key "phc_SITE1_KEY"
bin/magento config:set --scope=websites --scope-code=site2 posthog/general/project_api_key "phc_SITE2_KEY"

```

How It Works
------------

[](#how-it-works)

The module adds the PostHog tracking script to all frontend pages via the `default.xml` layout. The script is injected into the `after.body.start` container for optimal performance.

File Structure
--------------

[](#file-structure)

```
KingfisherDirect/Posthog/
├── Block/
│   └── Script.php                # Block class for rendering
├── Helper/
│   └── Data.php                  # Helper for configuration
├── Model/
│   └── Config/
│       └── Source/
│           └── PersonProfiles.php # Source model for dropdown
├── etc/
│   ├── acl.xml                   # ACL configuration
│   ├── adminhtml/
│   │   └── system.xml            # Admin system configuration
│   ├── config.xml                # Default configuration values
│   ├── csp_whitelist.xml         # CSP whitelist
│   └── module.xml                # Module declaration
├── view/
│   └── frontend/
│       ├── layout/
│       │   └── default.xml       # Global layout
│       └── templates/
│           └── script.phtml      # PostHog script template
└── registration.php              # Module registration

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance61

Regular maintenance activity

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/13ef32eef650c9bddea30c304036ba5bf091f051be75c05e0abb3aad6628a7e1?d=identicon)[lumnn](/maintainers/lumnn)

---

Top Contributors

[![Loghart](https://avatars.githubusercontent.com/u/64864113?v=4)](https://github.com/Loghart "Loghart (7 commits)")[![lumnn](https://avatars.githubusercontent.com/u/2505114?v=4)](https://github.com/lumnn "lumnn (1 commits)")

### Embed Badge

![Health badge](/badges/kingfisherdirect-magento2-posthog/health.svg)

```
[![Health](https://phpackages.com/badges/kingfisherdirect-magento2-posthog/health.svg)](https://phpackages.com/packages/kingfisherdirect-magento2-posthog)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
