kingfisherdirect/magento2-posthog
Composer 安装命令:
composer require kingfisherdirect/magento2-posthog
包简介
PostHog Analytics integration module for Magento 2
README 文档
README
PostHog Analytics integration module for Magento 2.
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
Navigate to: Stores > Configuration > General > PostHog
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
# Enable module
bin/magento module:enable KingfisherDirect_Posthog
# Run setup upgrade
bin/magento setup:upgrade
# Flush cache
bin/magento cache:flush
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
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
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
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
kingfisherdirect/magento2-posthog 适用场景与选型建议
kingfisherdirect/magento2-posthog 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 313 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「analytics」 「tracking」 「magento2」 「posthog」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kingfisherdirect/magento2-posthog 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kingfisherdirect/magento2-posthog 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kingfisherdirect/magento2-posthog 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Russian Language Pack for Magento 2
DPD Magento2 Shipping extension
PHP SDK for the Parcel Monkey UK API
Analytics chooser extensions for site settings.
Auto generate related products for Magento 2
A Laravel Nova Card to show Fathom Analytics stats.
统计信息
- 总下载量: 313
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2025-12-12