Download the PHP package yii-dream-team/yii2-tracking-controller without Composer
On this page you can find all versions of the php package yii-dream-team/yii2-tracking-controller. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download yii-dream-team/yii2-tracking-controller
More information about yii-dream-team/yii2-tracking-controller
Files in yii-dream-team/yii2-tracking-controller
Download yii-dream-team/yii2-tracking-controller
More information about yii-dream-team/yii2-tracking-controller
Files in yii-dream-team/yii2-tracking-controller
Vendor yii-dream-team
Package yii2-tracking-controller
Short Description Yii2 tracking controller behavior
License MIT
Package yii2-tracking-controller
Short Description Yii2 tracking controller behavior
License MIT
Please rate this library. Is it a good library?
Informations about the package yii2-tracking-controller
Yii2 tracking controller behavior
Yii2 controller behavior that captures tracking params from the query. Captured parameters are stored in session and you can access them any time.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist yii-dream-team/yii2-tracking-controller "*"
or add
"yii-dream-team/yii2-tracking-controller": "*"
to the require
section of your composer.json.
Usage as controller behavior
Attach the behavior to your controller class:
public function behaviors()
{
return [
'utm_campaign' => [
'class' => '\yiidreamteam\behaviors\TrackingController',
'queryParam' => 'utm_campaign',
'sessionParam' => 'utm_campaign',
],
'utm_source' => [
'class' => '\yiidreamteam\behaviors\TrackingController',
'queryParam' => 'utm_source',
'sessionParam' => 'utm_source',
],
];
}
Single param tracking:
$utmCampaign = $this->trackingParam;
Or
$utmCampaign = $this->getTrackingParam('unknown_campaign');
Tracking multiple parameters:
$utmSource = $this->behaviors['utm_source']->trackingParam;
$utmCampaign = $this->behaviors['utm_campaign']->trackingParam;
Or:
$utmSource = $this->behaviors['utm_source']->getTrackingParam('unknown_source');
$utmCampaign = $this->behaviors['utm_campaign']->getTrackingParam('unknown_campaign');
Licence
MIT
Links
All versions of yii2-tracking-controller with dependencies
PHP Build Version
Package Version
The package yii-dream-team/yii2-tracking-controller contains the following files
Loading the files please wait ....