The Gitlab instance will be restarted on Monday April 28th at 2AM. There will be a short interruption of service.

Skip to content
Snippets Groups Projects
Commit 6a870d97 authored by Chris Hallberg's avatar Chris Hallberg
Browse files

Lightbox Google Analytics adjustment improve accuracy with previously unknown settings.

parent 55e25398
No related merge requests found
...@@ -118,6 +118,7 @@ class AbstractBase extends AbstractActionController ...@@ -118,6 +118,7 @@ class AbstractBase extends AbstractActionController
'layout', $this->params()->fromQuery('layout', false) 'layout', $this->params()->fromQuery('layout', false)
)) { )) {
$this->layout()->setTemplate('layout/lightbox'); $this->layout()->setTemplate('layout/lightbox');
$this->layout()->lburl = $_SERVER["REQUEST_URI"];
} }
return new ViewModel($params); return new ViewModel($params);
} }
......
...@@ -69,17 +69,22 @@ class GoogleAnalytics extends \Zend\View\Helper\AbstractHelper ...@@ -69,17 +69,22 @@ class GoogleAnalytics extends \Zend\View\Helper\AbstractHelper
* *
* @return string * @return string
*/ */
public function __invoke() public function __invoke($customUrl = false)
{ {
error_log($customUrl);
if (!$this->key) { if (!$this->key) {
return ''; return '';
} }
if (!$this->universal) { if (!$this->universal) {
$code = 'var key = "' . $this->key . '";' . "\n" $code = 'var key = "' . $this->key . '";' . "\n"
. "var _gaq = _gaq || [];\n" . "var _gaq = _gaq || [];\n"
. "_gaq.push(['_setAccount', key]);\n" . "_gaq.push(['_setAccount', key]);\n";
. "_gaq.push(['_trackPageview']);\n" if ($customUrl) {
. "(function() {\n" $code .= "_gaq.push(['_trackPageview', '" . $customUrl . "']);\n";
} else {
$code .= "_gaq.push(['_trackPageview']);\n";
}
$code .= "(function() {\n"
. "var ga = document.createElement('script'); " . "var ga = document.createElement('script'); "
. "ga.type = 'text/javascript'; ga.async = true;\n" . "ga.type = 'text/javascript'; ga.async = true;\n"
. "ga.src = ('https:' == document.location.protocol ? " . "ga.src = ('https:' == document.location.protocol ? "
......
<?=$this->layout()->content?> <?=$this->layout()->content?>
<?=$this->googleanalytics()?> <?=$this->googleanalytics($this->layout()->lburl)?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment