From 9f236f053108a8cf8276078b273bdc2c46e833ab Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 13 Feb 2017 18:24:35 +0200 Subject: [PATCH] ga tests --- frontend/controllers/ArticlesController.php | 6 ++++++ frontend/views/articles/show.php | 3 +++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/frontend/controllers/ArticlesController.php b/frontend/controllers/ArticlesController.php index 010169e..79e595a 100755 --- a/frontend/controllers/ArticlesController.php +++ b/frontend/controllers/ArticlesController.php @@ -33,9 +33,15 @@ class ArticlesController extends Controller public function actionShow($translit){ $news = $this->findModel($translit); + if ($translit == 'kak-vybrat-ryukzak-dlya-lyzh') { + $ga_author = 'Author1'; + } else { + $ga_author = 'Author2'; + } return $this->render('show', [ 'news'=>$news, + 'author'=>$ga_author ]); } diff --git a/frontend/views/articles/show.php b/frontend/views/articles/show.php index cf9b469..a814e9c 100755 --- a/frontend/views/articles/show.php +++ b/frontend/views/articles/show.php @@ -8,6 +8,9 @@ use yii\widgets\Breadcrumbs; $this->title = $news->meta_title; $this->params['seo']['title'] = !empty($this->title) ?$this->title :$news->title; $this->registerMetaTag(['name' => 'description', 'content' => $news->meta_description]); +$this->registerJs(" + _gaq.push(['_setCustomVar',2,'Author','".$author."',3]); +", View::POS_TOP, 'author'); ?>