Yii2 Multi Web Statistic Module
ΒΆ
NOTE: Module is in initial development. Anything may change at any time. ΠΠ° Π΄Π°Π½Π½ΡΠΉ ΠΌΠΎΠΌΠ΅Π½Ρ ΡΠ΅ΠΊΡΡΠ°Ρ ΡΠ°Π±ΠΎΡΠ°Ρ Π²Π΅ΡΡΠΈΡ v0.3 - Π΅ΡΡΡ ΡΠΎΠ»ΡΠΊΠΎ ΡΡΠ΅ΡΡΠΈΠΊΠΈ ΡΠ½Π΄Π΅ΠΊΡΠ° ΠΈ google ΠΈ ΡΠΎΠ±ΡΡΠ²Π΅Π½Π½ΡΠΉ ΡΡΠ΅ΡΡΠΈΠΊ Π² DB
Statistics and Analytics module for your website. Many systems of your choice, connect either in the config module or in the admin panel:
- Π―Π½Π΄Π΅ΠΊΡ-ΠΠ΅ΡΡΠΈΠΊΠ°
- Google Analytics
- Liveinternet
- TopMail
- Bigmir (Π΄Π»Ρ ΡΠΊΡΠ°ΠΈΠ½ΡΠΊΠΎΠΉ Π°ΡΠ΄ΠΈΡΠΎΡΠΈΠΈ)
- Alexa
- Hotlog
- Rambler
- Openstat
- ΠΈ Π΄Π°ΠΆΠ΅ Π½Π° Π²ΡΠ±ΠΎΡ ΡΠΎΠ±ΡΡΠ²Π΅Π½Π½Π°Ρ ΡΠΈΡΡΠ΅ΠΌΠ° Π΄Π»Ρ ΠΎΡΡΠ»Π΅ΠΆΠΈΠ²Π°Π½ΠΈΡ ΠΏΠΎΡΠ΅ΡΠΈΡΠ΅Π»Π΅ΠΉ ΠΏΠΎ ΠΈΡ IP-Π°Π΄ΡΠ΅ΡΠ°ΠΌ ΠΈ cookie.
To develop the Yii2 Stat module, the developments of these modules were used:
- klisl/yii2-statistics (inspired)
- hiqdev/yii2-yandex-metrika (code)
Sometimes not all site visits are recorded by Yandex or Google counters. To visit was accurately counted (and this is very important for tracking advertising sources), use server logs or in our case you can use the minimum working counter in PHP.
Features ΒΆ
- Π²Ρ ΠΌΠΎΠΆΠ΅ΡΠ΅ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΡ Π²Π½Π΅ΡΠ½ΠΈΠ΅ ΡΠ΅ΡΠ²ΠΈΡΡ Π½Π° ΡΠ²ΠΎΠΉ Π²ΠΊΡΡ, Π²ΡΠ±ΠΎΡ ΠΏΡΠΎΡΡΡΠΌ ΠΊΠΎΠ½ΡΠΈΠ³ΡΡΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ΠΌ ΠΌΠΎΠ΄ΡΠ»Ρ
- Π΅ΡΡΡ ΡΠΎΠ±ΡΡΠ²Π΅Π½Π½Π°Ρ ΠΏΡΠΎΡΡΠ°Ρ ΡΠΈΡΡΠ΅ΠΌΠ° ΡΠ±ΠΎΡΠ° ΡΡΠ°ΡΠΈΡΡΠΈΠΊΠΈ
- Π΄Π°Π½Π½ΡΠ΅ Ρ ΡΠ°Π½ΡΡΡΡ Π² ΠΎΡΠ΄Π΅Π»ΡΠ½ΠΎΠΉ ΡΠ°Π±Π»ΠΈΡΠ΅ Π±Π°Π·Ρ Π΄Π°Π½Π½ΡΡ ΠΈΠ»ΠΈ Π½Π° Π²Π°ΡΠ΅ ΡΡΠΌΠΎΡΡΠ΅Π½ΠΈΠ΅ (Redis, etc)
- ΡΡΠ°ΡΠΈΡΡΠΈΠΊΠ° ΡΠΎΡΠΌΠΈΡΡΠ΅ΡΡΡ Π½Π° ΠΎΡΠ½ΠΎΠ²Π΅ ΡΠ½ΠΈΠΊΠ°Π»ΡΠ½ΡΡ IP Π°Π΄ΡΠ΅ΡΠΎΠ² ΠΏΠΎΡΠ΅ΡΠΈΡΠ΅Π»Π΅ΠΉ ΡΠ°ΠΉΡΠ°/ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ ΠΈ Cookie
- ΠΌΠΎΠΆΠ½ΠΎ ΠΏΠΎΡΠΌΠΎΡΡΠ΅ΡΡ ΡΡΡΠ°Π½Ρ, Π³ΠΎΡΠΎΠ΄, ΠΊΠ°ΠΊΠΎΠΉ Π±ΡΠ°ΡΠ·Π΅Ρ ΠΈ ΡΠ°ΡΡΠΈΡΠ΅Π½ΠΈΠ΅, referer
- ΠΈΡΡΠΎΡΠ½ΠΈΠΊ ΠΏΠ΅ΡΠ΅Ρ ΠΎΠ΄Π° (inner, search, direct, ads (from UTM-tags), unknown)
- ΠΎΡΡΠ΅ΠΈΠ²Π°Π½ΠΈΠ΅ ΠΏΠΎΠΈΡΠΊΠΎΠ²ΡΡ Π±ΠΎΡΠΎΠ² (11ΡΡ)
- Π΅ΡΡΡ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΡ Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΡ IP, ΠΊΠΎΡΠΎΡΡΠ΅ Π½Π΅ Π½ΡΠΆΠ½Ρ Π² ΡΡΠ°ΡΠΈΡΡΠΈΠΊΠ΅, Π² ΡΠ΅ΡΠ½ΡΠΉ ΡΠΏΠΈΡΠΊΠΎΠΊ
- ΡΠ΄ΠΎΠ±Π½Π°Ρ ΡΠΈΠ»ΡΡΡΠ°ΡΠΈΡ Π²ΡΠ²ΠΎΠ΄Π° ΡΠ΅Π·ΡΠ»ΡΡΠ°ΡΠΎΠ² ΡΡΠ°ΡΠΈΡΡΠΈΠΊΠΈ (Π·Π° Π΄Π΅Π½Ρ, ΠΏΠ΅ΡΠΈΠΎΠ΄, ΠΏΠΎ ΠΎΠΏΡΠ΅Π΄Π΅Π»Π΅Π½Π½ΠΎΠΌΡ IP)
What information is displayed for each individual visitor:
- its unique IP address with the ability to obtain information about its location
- URL of the page being viewed and number of clicks
- time to visit a particular page
Installation ΒΆ
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist akiraz2/yii2-stat "dev-master"
or add
"akiraz2/yii2-stat": "dev-master"
to the require section of your composer.json file.
Migration ΒΆ
Migration run
yii migrate --migrationPath=@akiraz2/stat/migrations
Config ΒΆ
Config common modules in common/config/main.php
'modules' => [
'stat' => [
'class' => akiraz2\stat\Module::class,
'yandexMetrika' => [ // false by default
'id' => 13788753,
'params' => [
'clickmap' => true,
'trackLinks' => true,
'accurateTrackBounce' => true,
'webvisor' => true
]
],
'googleAnalytics' => [ // false by default
'id' => 'UA-114443409-2',
],
'ownStat' => true, //false by default
'ownStatCookieId' => 'yii2_counter_id', // 'yii2_counter_id' default
'onlyGuestUsers' => true, // true default
'countBot' => false, // false default
'appId' => ['app-frontend'], // by default count visits only from Frontend App (in backend app we dont need it)
'blackIpList' => [], // ['127.0.0.1'] by default
// ΡΠ°Π·ΠΌΠ΅ΡΠ°Π΅ΠΌ Π½Π°ΡΡ Π°Π΄ΠΌΠΈΠ½ ΠΏΠ°Π½Π΅Π»Ρ Π½Π° backend Ρ ΠΏΡΠΎΠ²Π΅ΡΠΊΠΎΠΉ Π΄ΠΎΡΡΡΠΏΠ° ΠΈΠ»ΠΈ ΡΠΎΠ»ΡΠΌΠΈ (Π·Π΄Π΅ΡΡ ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅ΡΡΡ dektrium/user)
'controllerMap' => [
'dashboard' => [
'class' => 'akiraz2\stat\controllers\DashboardController',
'as access' => [
'class' => \yii\filters\AccessControl::class,
'rules' => [
[
'allow' => true,
'roles' => ['@'],
'matchCallback' => function () {
return Yii::$app->user->identity->getIsAdmin();
},
],
],
],
],
],
],
],
Usage ΒΆ
//
ΠΠ»Ρ ΠΏΠ΅ΡΠ΅Ρ ΠΎΠ΄Π° Π½Π° ΡΡΡΠ°Π½ΠΈΡΡ ΡΡΠ°ΡΠΈΡΡΠΈΠΊΠΈ
- Ρ Π²ΠΊΠ»ΡΡΠ΅Π½Π½ΡΠΌ Π§ΠΠ£ Π² Π½Π°ΡΡΡΠΎΠΉΠΊΠ°Ρ ΠΠ°ΡΠ΅Π³ΠΎ ΠΏΡΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΡ: http://your-site.com/stat/dashboard/index
- Π±Π΅Π· Π§ΠΠ£: http://your-site.com/web/index.php?r=stat/dashboard/index
Development ΒΆ
TODO ΒΆ
- Optimize db usage (for inner db-counter)
- Real dashboard, analytics
- Remove unnecessary code from previous packages
- Add other services (Hotlog, Openstat, etc)
- Translate dashboard
Please translate to your language! Edit config @vendor/akiraz2/yii2-stat/src/messages/config.php, add your language and run script:
`php
php ./yii message/extract @akiraz2/stat/messages/config.php
`
translate file will be in @vendor/akiraz2/yii2-stat/src/messages/ or your configured path
Support ΒΆ
If you have any questions or problems with Yii2-Stat you can ask them directly
by using following email address: akiraz@bk.ru.
Contributing ΒΆ
If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome. +PSR-2 style coding.
I can apply patch, PR in 2-3 days! If not, please write me akiraz@bk.ru
Licensing ΒΆ
Yii2-Stat is released under the MIT License. See the bundled LICENSE.md for details.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.