diff --git a/app/app_controller.php b/app/app_controller.php index d9548e9a1..eb9e10ea2 100644 --- a/app/app_controller.php +++ b/app/app_controller.php @@ -126,7 +126,11 @@ public function beforeFilter() $this->set('trackingId', $trackingId); $this->set('domain', $domain); $this->set('customLogo', $customLogo); - + + // for setting up google tag manager + $gtmContainerId = $this->SysParameter->findByParameterCode('google_tag_manager.container_id'); + $this->set('gtmContainerId', $gtmContainerId); + parent::beforeFilter(); } diff --git a/app/config/core.php b/app/config/core.php index bafe3510e..c1971e5a6 100644 --- a/app/config/core.php +++ b/app/config/core.php @@ -320,7 +320,7 @@ /** * iPeer database version */ - Configure::write('DATABASE_VERSION', 15); + Configure::write('DATABASE_VERSION', 16); $CWL['LoginURL'] = 'https://www.auth.cwl.ubc.ca/auth/login'; diff --git a/app/config/sql/delta_16.sql b/app/config/sql/delta_16.sql new file mode 100644 index 000000000..1eff97660 --- /dev/null +++ b/app/config/sql/delta_16.sql @@ -0,0 +1,12 @@ +-- +-- Canvas integration +-- + +INSERT INTO `sys_parameters` ( + `parameter_code`, `parameter_value`, + `parameter_type`, `description`, `record_status`, `creator_id`, `created`, + `updater_id`, `modified`) +VALUES ( + 'google_tag_manager.container_id', '', 'S', + 'Container ID for Google Tag Manager (GTM-XXXX)', 'A', 0, NOW(), NULL, NOW() +); \ No newline at end of file diff --git a/app/views/layouts/default.ctp b/app/views/layouts/default.ctp index 460058718..3e2fe45f7 100644 --- a/app/views/layouts/default.ctp +++ b/app/views/layouts/default.ctp @@ -41,10 +41,36 @@ // Custom View Include Files echo $scripts_for_layout; + + // check that a google tag manager container id is given + $gtmHead = null; + $gtmBody = null; + if (!empty($gtmContainerId) && !empty($gtmContainerId['SysParameter']['parameter_value'])) { + $gtmContainerId = $gtmContainerId['SysParameter']['parameter_value']; + + $gtmHead = " + + + + "; + $gtmBody = ' + + + + '; + } + + echo $gtmHead; ?> + - +
element('global/banner', array('customLogo' => $customLogo)); ?>