From 427a865ad2b0ce67624e775d66c976dea1bd30cf Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 26 Jul 2016 14:23:53 +0000 Subject: [PATCH] done #483 @1.5 --- framework/application/configs/application.ini | 3 +- .../controllers/AjaxController.php | 12 +++--- .../application/views/helpers/Exemples.php | 2 +- .../application/views/helpers/LinkQuote.php | 2 +- .../views/scripts/common/footer.phtml | 4 +- js/002-common.js | 43 +++++++++++++++++++ less/002-common.less | 1 + less/240-text.less | 2 +- 8 files changed, 57 insertions(+), 12 deletions(-) diff --git a/framework/application/configs/application.ini b/framework/application/configs/application.ini index 810434a..d0a0eb8 100644 --- a/framework/application/configs/application.ini +++ b/framework/application/configs/application.ini @@ -48,7 +48,6 @@ webhost = www.fluidbook.com locales.fr = www.fluidbook.com locales.en = en.fluidbook.com - acl.perpage = true acl.roles[] = superadmin acl.roles[] = admin @@ -64,7 +63,7 @@ firephp = true minify.js = false -seo.universalAnalytics = +seo.universalAnalytics = UA-4339912-9 httpauth.username = fluidbook httpauth.password = fb2016 diff --git a/framework/application/controllers/AjaxController.php b/framework/application/controllers/AjaxController.php index a834f5a..b4eaf78 100644 --- a/framework/application/controllers/AjaxController.php +++ b/framework/application/controllers/AjaxController.php @@ -8,7 +8,7 @@ class AjaxController extends CubeIT_Controller_AjaxController { // Take form ID from URL so we can differentiate between the popup and the embedded versions of the form if ($formID) { $form->setId($formID); - $form->setAction($form->getAction() .'/'. $formID); + $form->setAction($form->getAction() . '/' . $formID); } else { $formID = $form->getId(); } @@ -18,14 +18,16 @@ class AjaxController extends CubeIT_Controller_AjaxController { $xml = simplexml_load_file($url); $okmessage = array_pop($xml->xpath('//alert')); - if(null!==$okmessage){ - $okmessage=(string)$okmessage->content; + if (null !== $okmessage) { + $okmessage = (string)$okmessage->content; } - - $this->_datas->addReplace('#'. $formID, '
' . $okmessage . '
'); + + $this->_datas->addReplace('#' . $formID, '
' . $okmessage . '
'); + $this->_datas->addGAEvent('form', 'sent', 'quote'); } else { $this->_datas->refreshForm($form); // Respond with validation errors $this->_datas->addAction('eval', "displayErrors('$formID')"); + $this->_datas->addGAEvent('form', 'error', 'quote'); } } diff --git a/framework/application/views/helpers/Exemples.php b/framework/application/views/helpers/Exemples.php index cdd9ed9..975741f 100644 --- a/framework/application/views/helpers/Exemples.php +++ b/framework/application/views/helpers/Exemples.php @@ -121,7 +121,7 @@ class Fluidbook_View_Helper_Exemples extends CubeIT_View_Helper_Abstract { protected function _rollover($f, $category) { $res = ''; if ($f->getUrl()) { - $res = $this->link(__('Voir le Fluidbook'), $f->getUrl(), array('class' => 'button')); + $res = $this->link(__('Voir le Fluidbook'), $f->getUrl(), array('class' => 'button', 'data-event' => array('category' => 'exemple', 'action' => 'see', 'label' => $f->getTitle()))); } if ($category == 3) { $firstCat = 0; diff --git a/framework/application/views/helpers/LinkQuote.php b/framework/application/views/helpers/LinkQuote.php index 08fb270..30b4636 100644 --- a/framework/application/views/helpers/LinkQuote.php +++ b/framework/application/views/helpers/LinkQuote.php @@ -7,6 +7,6 @@ class Fluidbook_View_Helper_LinkQuote extends CubeIT_View_Helper_Abstract { public function linkQuote($label) { $this->headScript()->addScriptAndStyle('005-fancyselect'); $this->headScript()->addScriptAndStyle('315-quote'); - return $this->linkPopup($label, '/ajaxpopup/quoteForm', array('class' => 'quoteLink')); + return $this->linkPopup($label, 'internal:contact', array('data-popup-href' => '/ajaxPopup/quoteForm', 'class' => 'quoteLink', 'data-event' => array('category' => 'form', 'action' => 'open', 'label' => 'quote'))); } } \ No newline at end of file diff --git a/framework/application/views/scripts/common/footer.phtml b/framework/application/views/scripts/common/footer.phtml index a7d9458..d7ff418 100644 --- a/framework/application/views/scripts/common/footer.phtml +++ b/framework/application/views/scripts/common/footer.phtml @@ -38,13 +38,13 @@ foreach ($this->option('social_networks') as $social) { $res .= ''; - $res .= ''; + $res .= $this->link('', $social['url'], array('id' => 's-' . $social['icon'], 'class' => 'social-link fb-' . $social['icon'], 'data-event' => array('category' => 'social', 'action' => 'go', 'label' => $social['icon']))); $res .= ''; } $res .= ''; // .footer-external $res .= '
'; -$res .= $this->linkCMS($this->option('workshop'), array('class' => 'workshop-link')); +$res .= $this->linkCMS($this->option('workshop'), array('class' => 'workshop-link', 'data-event' => array('category' => 'external', 'action' => 'go', 'label' => 'workshop'))); $res .= '
'; // .workshop $res .= ''; // .external-links diff --git a/js/002-common.js b/js/002-common.js index 59b9b73..870716c 100644 --- a/js/002-common.js +++ b/js/002-common.js @@ -2,6 +2,49 @@ registerLoader(load_common, true); var zoom = 1; function load_common() { + // Google analytics + + $('a[href^="mailto:"]').not('[data-event]').each(function () { + var email = $(this).attr('href').split(':'); + var label = email.pop(); + var e = { + category: 'email', + action: 'click', + label: label, + value: 1 + }; + $(this).attr('data-event', JSON.stringify(e)); + }); + + $('a[href^="tel:"]').not('[data-event]').each(function () { + var tel = $(this).attr('href').split(':'); + var label = tel.pop(); + + var e = { + category: 'tel', + action: 'call', + label: label, + value: 1 + }; + $(this).attr('data-event', JSON.stringify(e)); + }); + + $(document).on('click', '[data-event]', function () { + var e = $(this).data('event'); + if (e.value === undefined) { + e.value = 1; + } + if (e.action === undefined) { + e.action = 'click'; + } + + e.label = e.label.replace(/%href%/gi, $(this).attr('href')); + + ga('send', 'event', e.category, e.action, e.label, e.value); + return true; + }); + + $(window).on('cubeitresize', resize); resize(); } diff --git a/less/002-common.less b/less/002-common.less index c144112..1219281 100644 --- a/less/002-common.less +++ b/less/002-common.less @@ -16,6 +16,7 @@ body { min-width: @content-min-width; -moz-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; + color: #151e28; @media @m900 { font-size: 12px; diff --git a/less/240-text.less b/less/240-text.less index a87f7c5..32acad3 100644 --- a/less/240-text.less +++ b/less/240-text.less @@ -17,7 +17,7 @@ h2 { } } -.content-wrapper { +main .content-wrapper { width: auto !important; box-sizing: content-box; // Needed so we can control the content max-width without the % padding interfering max-width: 670px; -- 2.39.5