{"id":15029039,"url":"https://github.com/gabrielslau/cakephp-mixpanel","last_synced_at":"2026-02-09T07:02:31.132Z","repository":{"id":57030669,"uuid":"90311301","full_name":"gabrielslau/CakePHP-Mixpanel","owner":"gabrielslau","description":"Mixpanel plugin for CakePHP 3.0","archived":false,"fork":false,"pushed_at":"2017-05-16T19:09:12.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-19T21:48:39.369Z","etag":null,"topics":["analytics-tracking","cakephp","component","embed","helper","javascript","mixpanel","php56"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gabrielslau.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-04T21:29:38.000Z","updated_at":"2017-05-05T23:06:53.000Z","dependencies_parsed_at":"2022-08-23T18:50:41.270Z","dependency_job_id":null,"html_url":"https://github.com/gabrielslau/CakePHP-Mixpanel","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielslau%2FCakePHP-Mixpanel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielslau%2FCakePHP-Mixpanel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielslau%2FCakePHP-Mixpanel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielslau%2FCakePHP-Mixpanel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabrielslau","download_url":"https://codeload.github.com/gabrielslau/CakePHP-Mixpanel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243338533,"owners_count":20275525,"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-tracking","cakephp","component","embed","helper","javascript","mixpanel","php56"],"created_at":"2024-09-24T20:09:37.179Z","updated_at":"2026-02-09T07:02:26.088Z","avatar_url":"https://github.com/gabrielslau.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"LICENSE.txt\" target=\"_blank\"\u003e\n        \u003cimg alt=\"Software License\" src=\"https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://app.codeship.com/projects/220010\" target=\"_blank\"\u003e\n        \u003cimg alt=\"Build Status\" src=\"https://img.shields.io/codeship/b2c9f990-1c64-0135-200b-020110d102f0.svg?style=flat-square\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://app.codeship.com/projects/220010\" target=\"_blank\"\u003e\n        \u003cimg alt=\"Build Status\" src=\"https://app.codeship.com/projects/47da23f0-1c84-0135-820b-56a4cb57cee4/status?branch=master\u0026style=flat-square\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/okatsuralau/cakephp-mixpanel\" target=\"_blank\"\u003e\n        \u003cimg alt=\"Latest Stable Version\" src=\"https://img.shields.io/packagist/v/okatsuralau/cakephp-mixpanel.svg?style=flat-square\u0026label=stable\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nCakePHP Mixpanel Plugin\n=======================\n\nThis plugin provides a Mixpanel component to track events from your controllers using the official [Mixpanel PHP library](https://github.com/mixpanel/mixpanel-php).\n\nRequirements\n------------\n\n- PHP \u003e= 5.6\n- CakePHP \u003e= 3.0\n\n\nHow to Install\n----------\n\n```\ncomposer require okatsuralau/cakephp-mixpanel@1.0.0\n```\n\nHow to Use\n----------\n\nLoad the plugin in your `config/bootstrap.php` file:\n```\nPlugin::load('CakephpMixpanel');\n```\n\nAdd the plugin configurations in your `config/app.php` or `config/app_custom.php` file:\n\n```php\nreturn [\n    //...\n    \n    'Mixpanel' =\u003e [\n        'token' =\u003e YOUR_TOKEN_HERE\n    ]\n]\n```\n\nLoad the component in your `src/Controller/AppController.php`\n\n```php\npublic function initialize()\n{\n    parent::initialize();\n\n    $this-\u003eloadComponent('CakephpMixpanel.Mixpanel');\n}\n```\n\nand (optionally) add the following code to your `beforeFilter()` method to identify the users actions\n\n```php\npublic function beforeFilter(\\Cake\\Event\\Event $event)\n{\n    // if a user is logged in\n    $this-\u003eMixpanel-\u003eidentify($user_id);\n    $this-\u003eMixpanel-\u003ename_tag($user_name);\n    $this-\u003eMixpanel-\u003eregister($superProperties);\n    \n    /* To make use of the people API */\n    $this-\u003eMixpanel-\u003epeople($this-\u003eAuth-\u003euser('id'), array(\n        '$username' =\u003e $this-\u003eAuth-\u003euser('username'),\n        '$email' =\u003e $this-\u003eAuth-\u003euser('email'),\n        '$created' =\u003e $this-\u003eAuth-\u003euser('created'),\n        '$last_login' =\u003e $this-\u003eAuth-\u003euser('connected'),\n        'my_custom_var' =\u003e $my_custom_var,\n    ));\n    \n    // ...\n    \n    parent::beforeFilter($event);\n}\n```\n\nTo register an event, put the following code in your controller action.\n`src/Controller/PostController.php`\n\n```php\npublic function index()\n{\n    // ...\n    \n    $this-\u003eMixpanel-\u003etrack(\n        'Post list', \n        [\n            'author' =\u003e $this-\u003eAuth-\u003euser('name'),\n            'category' =\u003e 'Post',\n        ]\n    );\n}\n\npublic function create()\n{\n    if ($this-\u003erequest-\u003eis('post')) {\n        \n        // ...\n        \n        $this-\u003eMixpanel-\u003etrack(\n            'Post Created', \n            [\n                'author' =\u003e $this-\u003eAuth-\u003euser('name'),\n                'category' =\u003e 'Post',\n            ]\n        );\n        \n        $this-\u003eredirect(array('action'=\u003e'index'));\n    }\n}\n```\n\nThis should be enough to start sending events to Mixpanel.\n\nLicense\n-------\n\nCopyright 2017 Gabriel Lau\n\nAvailable for you to use under the MIT license. See: http://www.opensource.org/licenses/MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielslau%2Fcakephp-mixpanel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabrielslau%2Fcakephp-mixpanel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielslau%2Fcakephp-mixpanel/lists"}