From d09b428906dd9ea83f2368f5594ee6fe14ea8d64 Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@git-test.afi-sa.fr> Date: Fri, 14 Jun 2013 09:12:07 +0000 Subject: [PATCH] Google analytics: maj trackEvent --- application/modules/opac/controllers/AuthController.php | 2 +- library/ZendAfi/Controller/Action/Helper/TrackEvent.php | 9 +++++---- .../modules/opac/controllers/AuthControllerTest.php | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/application/modules/opac/controllers/AuthController.php b/application/modules/opac/controllers/AuthController.php index 01c12d498c9..c29873dbdbe 100644 --- a/application/modules/opac/controllers/AuthController.php +++ b/application/modules/opac/controllers/AuthController.php @@ -55,7 +55,7 @@ class AuthController extends Zend_Controller_Action return $this->view->_('Identifiant ou mot de passe incorrect.'); $user = Class_Users::getIdentity(); - $this->_helper->trackEvent('authentification', 'login', $user->getId()); + $this->_helper->trackEvent('authentification', 'connexion', 'utilisateur', 'id: '.$user->getId()); $service_cas_server=$this->_request->getPost('service'); if (strlen($service_cas_server)>1) { $ticket=md5(Zend_Session::getId()); diff --git a/library/ZendAfi/Controller/Action/Helper/TrackEvent.php b/library/ZendAfi/Controller/Action/Helper/TrackEvent.php index ad6f8d67a40..8ccc4067f8d 100644 --- a/library/ZendAfi/Controller/Action/Helper/TrackEvent.php +++ b/library/ZendAfi/Controller/Action/Helper/TrackEvent.php @@ -23,17 +23,18 @@ class ZendAfi_Controller_Action_Helper_TrackEvent extends Zend_Controller_Action /** * voir [[file:~/public_html/afi-opac3/library/Class/ScriptLoader.php::public%20function%20executeTrackEvents()%20{][Class_ScriptLoader::executeTrackEvents]] */ - public function trackEvent($category, $action, $value) { + public function trackEvent($category, $action, $label, $value) { $this->getActionController() ->getHelper('flashMessenger') ->addMessage([ZendAfi_Controller_Action_Helper_FlashMessenger::TRACK_EVENT => ['category' => $category, 'action' => $action, - 'value' => 2]]); + 'label' => $label, + 'value' => $value]]); } - public function direct($category, $action, $value) { - return $this->trackEvent($category, $action, $value); + public function direct($category, $action, $label, $value) { + return $this->trackEvent($category, $action, $label, $value); } } diff --git a/tests/application/modules/opac/controllers/AuthControllerTest.php b/tests/application/modules/opac/controllers/AuthControllerTest.php index c79fe9ee444..042b088535b 100644 --- a/tests/application/modules/opac/controllers/AuthControllerTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerTest.php @@ -480,8 +480,9 @@ class AuthControllerPostSimpleSuccessfulTest extends AuthControllerPostSimpleTes public function trackEventShouldBeGenerated() { $this->assertFlashMessengerContains(['track_event' => ['category' => 'authentification', - 'action' => 'login', - 'value' => '2']]); + 'action' => 'connexion', + 'label' => 'utilisateur', + 'value' => 'id: 2']]); } } -- GitLab