This extension provides the third party tracking functionality which could be easily integrated into your project. The module is also intended for registration of information about a separate user session, data about the user's device and browser, his behavior on the site during a visit.
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require willarin/yii2-tracker "*"
or add
"willarin/yii2-tracker": "*"
to the required section of your composer.json
file.
Before using this extension, we need to prepare the database.
php yii migrate --migrationPath=@willarin/tracker/migrations
Each unique user's URL visit should be registered within a module. Our recommendation is to use bariew/yii2-event-component - eg.
'eventManager' => [
'class' => 'bariew\eventManager\EventManager',
'events' => [
'module\controllers\IndexController' => [
'beforeAction' => [
['willarin\tracker\models\SessionUrl', 'saveUrlVisit'],
],
],
]
],
Once the extension is installed, modify your application configuration to include:
return [
'modules' => [
...
'tracker' => [
'class' => 'willarin\tracker\Module',
]
...
],
...
]
Session This table stores data about cookies, server variables for the session, device type, OS, browser, click's cost and income received from a specific click.
SessionUrl This table stores data about each url visited by the user, duration of url's visit, number of scrolls up and down for a specific url.
SessionEvent This table stores custom data about events, each event could be associated with a certain URL
Person This table stores data about customer and his cookie string identifier