Commit 9f236f053108a8cf8276078b273bdc2c46e833ab

Authored by Alex Savenko
1 parent 2c6855c0

ga tests

frontend/controllers/ArticlesController.php
... ... @@ -33,9 +33,15 @@ class ArticlesController extends Controller
33 33 public function actionShow($translit){
34 34 $news = $this->findModel($translit);
35 35  
  36 + if ($translit == 'kak-vybrat-ryukzak-dlya-lyzh') {
  37 + $ga_author = 'Author1';
  38 + } else {
  39 + $ga_author = 'Author2';
  40 + }
36 41  
37 42 return $this->render('show', [
38 43 'news'=>$news,
  44 + 'author'=>$ga_author
39 45 ]);
40 46 }
41 47  
... ...
frontend/views/articles/show.php
... ... @@ -8,6 +8,9 @@ use yii\widgets\Breadcrumbs;
8 8 $this->title = $news->meta_title;
9 9 $this->params['seo']['title'] = !empty($this->title) ?$this->title :$news->title;
10 10 $this->registerMetaTag(['name' => 'description', 'content' => $news->meta_description]);
  11 +$this->registerJs("
  12 + _gaq.push(['_setCustomVar',2,'Author','".$author."',3]);
  13 +", View::POS_TOP, 'author');
11 14 ?>
12 15  
13 16 <nav class="bread-crumbs">
... ...