Added google analytics code to extra frontend pages like book_success, message, error404.
This commit is contained in:
parent
b3ce15d4f1
commit
c06f3def14
7 changed files with 80 additions and 20 deletions
|
@ -33,6 +33,9 @@ class Appointments extends CI_Controller {
|
||||||
} else {
|
} else {
|
||||||
$this->lang->load('translations', $this->config->item('language')); // default
|
$this->lang->load('translations', $this->config->item('language')); // default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Common helpers
|
||||||
|
$this->load->helper('google_analytics');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,7 +78,7 @@ class Appointments extends CI_Controller {
|
||||||
|
|
||||||
// If an appointment hash is provided then it means that the customer
|
// If an appointment hash is provided then it means that the customer
|
||||||
// is trying to edit a registered appointment record.
|
// is trying to edit a registered appointment record.
|
||||||
if ($appointment_hash !== ''){
|
if ($appointment_hash !== '') {
|
||||||
// Load the appointments data and enable the manage mode of the page.
|
// Load the appointments data and enable the manage mode of the page.
|
||||||
$manage_mode = TRUE;
|
$manage_mode = TRUE;
|
||||||
|
|
||||||
|
@ -107,8 +110,6 @@ class Appointments extends CI_Controller {
|
||||||
$customer = array();
|
$customer = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$google_analytics_code = $this->settings_model->get_setting('google_analytics_code');
|
|
||||||
|
|
||||||
// Load the book appointment view.
|
// Load the book appointment view.
|
||||||
$view = array (
|
$view = array (
|
||||||
'available_services' => $available_services,
|
'available_services' => $available_services,
|
||||||
|
@ -118,8 +119,7 @@ class Appointments extends CI_Controller {
|
||||||
'date_format' => $date_format,
|
'date_format' => $date_format,
|
||||||
'appointment_data' => $appointment,
|
'appointment_data' => $appointment,
|
||||||
'provider_data' => $provider,
|
'provider_data' => $provider,
|
||||||
'customer_data' => $customer,
|
'customer_data' => $customer
|
||||||
'google_analytics_code' => $google_analytics_code
|
|
||||||
);
|
);
|
||||||
} catch(Exception $exc) {
|
} catch(Exception $exc) {
|
||||||
$view['exceptions'][] = $exc;
|
$view['exceptions'][] = $exc;
|
||||||
|
|
|
@ -37,6 +37,7 @@ class Errors extends CI_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function error404() {
|
public function error404() {
|
||||||
|
$this->load->helper('google_analytics');
|
||||||
$this->load->model('settings_model');
|
$this->load->model('settings_model');
|
||||||
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
||||||
$this->load->view('general/error404', $view);
|
$this->load->view('general/error404', $view);
|
||||||
|
|
43
src/application/helpers/google_analytics_helper.php
Normal file
43
src/application/helpers/google_analytics_helper.php
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* Easy!Appointments - Open Source Web Scheduler
|
||||||
|
*
|
||||||
|
* @package EasyAppointments
|
||||||
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||||
|
* @copyright Copyright (c) 2013 - 2016, Alex Tselegidis
|
||||||
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||||
|
* @link http://easyappointments.org
|
||||||
|
* @since v1.1.0
|
||||||
|
* ---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print Google Analytics script.
|
||||||
|
*
|
||||||
|
* This helper function should be used in view files in order to output the Google Analytics
|
||||||
|
* script. It will check whether the code is set in the database and print it, otherwise nothing
|
||||||
|
* will be outputted. This eliminates the need for extra checking before outputting.
|
||||||
|
*/
|
||||||
|
function google_analytics_script() {
|
||||||
|
$ci =& get_instance();
|
||||||
|
|
||||||
|
$ci->load->model('settings_model');
|
||||||
|
|
||||||
|
$google_analytics_code = $ci->settings_model->get_setting('google_analytics_code');
|
||||||
|
|
||||||
|
if ($google_analytics_code !== '') {
|
||||||
|
echo '
|
||||||
|
<script>
|
||||||
|
(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,"script","//www.google-analytics.com/analytics.js","ga");
|
||||||
|
ga("create", "' . $google_analytics_code . '", "auto");
|
||||||
|
ga("send", "pageview");
|
||||||
|
</script>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file google_analytics.php */
|
||||||
|
/* Location: ./application/helpers/google_analytics.php */
|
|
@ -11,6 +11,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// INCLUDE CSS FILES
|
// INCLUDE CSS FILES
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<link
|
<link
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
type="text/css"
|
type="text/css"
|
||||||
|
@ -36,6 +37,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// INCLUDE JAVASCRIPT FILES
|
// INCLUDE JAVASCRIPT FILES
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<script
|
<script
|
||||||
type="text/javascript"
|
type="text/javascript"
|
||||||
src="<?php echo $this->config->item('base_url'); ?>/assets/ext/jquery/jquery.min.js"></script>
|
src="<?php echo $this->config->item('base_url'); ?>/assets/ext/jquery/jquery.min.js"></script>
|
||||||
|
@ -59,6 +61,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// WEBPAGE FAVICON
|
// WEBPAGE FAVICON
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<link rel="icon" type="image/x-icon"
|
<link rel="icon" type="image/x-icon"
|
||||||
href="<?php echo $this->config->item('base_url'); ?>/assets/img/favicon.ico">
|
href="<?php echo $this->config->item('base_url'); ?>/assets/img/favicon.ico">
|
||||||
|
|
||||||
|
@ -69,6 +72,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// VIEW FILE JAVASCRIPT CODE
|
// VIEW FILE JAVASCRIPT CODE
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var GlobalVariables = {
|
var GlobalVariables = {
|
||||||
availableServices : <?php echo json_encode($available_services); ?>,
|
availableServices : <?php echo json_encode($available_services); ?>,
|
||||||
|
@ -102,6 +106,7 @@
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
// FRAME TOP BAR
|
// FRAME TOP BAR
|
||||||
// ------------------------------------------------------ ?>
|
// ------------------------------------------------------ ?>
|
||||||
|
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<span id="company-name"><?php echo $company_name; ?></span>
|
<span id="company-name"><?php echo $company_name; ?></span>
|
||||||
|
|
||||||
|
@ -161,10 +166,12 @@
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
// SELECT SERVICE AND PROVIDER
|
// SELECT SERVICE AND PROVIDER
|
||||||
// ------------------------------------------------------ ?>
|
// ------------------------------------------------------ ?>
|
||||||
|
|
||||||
<div id="wizard-frame-1" class="wizard-frame">
|
<div id="wizard-frame-1" class="wizard-frame">
|
||||||
<div class="frame-container">
|
<div class="frame-container">
|
||||||
<h3 class="frame-title"><?php echo $this->lang->line('step_one_title'); ?></h3>
|
<h3 class="frame-title"><?php echo $this->lang->line('step_one_title'); ?></h3>
|
||||||
|
@ -257,6 +264,7 @@
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
// SELECT APPOINTMENT DATE
|
// SELECT APPOINTMENT DATE
|
||||||
// ------------------------------------------------------ ?>
|
// ------------------------------------------------------ ?>
|
||||||
|
|
||||||
<div id="wizard-frame-2" class="wizard-frame" style="display:none;">
|
<div id="wizard-frame-2" class="wizard-frame" style="display:none;">
|
||||||
<div class="frame-container">
|
<div class="frame-container">
|
||||||
|
|
||||||
|
@ -292,6 +300,7 @@
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
// ENTER CUSTOMER DATA
|
// ENTER CUSTOMER DATA
|
||||||
// ------------------------------------------------------ ?>
|
// ------------------------------------------------------ ?>
|
||||||
|
|
||||||
<div id="wizard-frame-3" class="wizard-frame" style="display:none;">
|
<div id="wizard-frame-3" class="wizard-frame" style="display:none;">
|
||||||
<div class="frame-container">
|
<div class="frame-container">
|
||||||
|
|
||||||
|
@ -357,6 +366,7 @@
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
// APPOINTMENT DATA CONFIRMATION
|
// APPOINTMENT DATA CONFIRMATION
|
||||||
// ------------------------------------------------------ ?>
|
// ------------------------------------------------------ ?>
|
||||||
|
|
||||||
<div id="wizard-frame-4" class="wizard-frame" style="display:none;">
|
<div id="wizard-frame-4" class="wizard-frame" style="display:none;">
|
||||||
<div class="frame-container">
|
<div class="frame-container">
|
||||||
<h3 class="frame-title"><?php echo $this->lang->line('step_four_title'); ?></h3>
|
<h3 class="frame-title"><?php echo $this->lang->line('step_four_title'); ?></h3>
|
||||||
|
@ -403,6 +413,7 @@
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
// FRAME FOOTER
|
// FRAME FOOTER
|
||||||
// ------------------------------------------------------ ?>
|
// ------------------------------------------------------ ?>
|
||||||
|
|
||||||
<div id="frame-footer">
|
<div id="frame-footer">
|
||||||
Powered By
|
Powered By
|
||||||
<a href="http://easyappointments.org" target="_blank">Easy!Appointments</a>
|
<a href="http://easyappointments.org" target="_blank">Easy!Appointments</a>
|
||||||
|
@ -425,15 +436,6 @@
|
||||||
type="text/javascript"
|
type="text/javascript"
|
||||||
src="<?php echo $this->config->item('base_url'); ?>/assets/js/general_functions.js"></script>
|
src="<?php echo $this->config->item('base_url'); ?>/assets/js/general_functions.js"></script>
|
||||||
|
|
||||||
<?php if ($google_analytics_code !== ''): ?>
|
<?php google_analytics_script(); ?>
|
||||||
<script>
|
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
||||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
||||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
||||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
||||||
ga('create', '<?php echo $google_analytics_code; ?>', 'auto');
|
|
||||||
ga('send', 'pageview');
|
|
||||||
</script>
|
|
||||||
<?php endif; ?>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -7,21 +7,21 @@
|
||||||
<meta name="theme-color" content="#35A768">
|
<meta name="theme-color" content="#35A768">
|
||||||
<title><?php echo $this->lang->line('appointment_registered') . ' - ' . $company_name; ?></title>
|
<title><?php echo $this->lang->line('appointment_registered') . ' - ' . $company_name; ?></title>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// INCLUDE CSS FILES
|
// INCLUDE CSS FILES
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css"
|
<link rel="stylesheet" type="text/css"
|
||||||
href="<?php echo $this->config->item('base_url'); ?>/assets/ext/bootstrap/css/bootstrap.min.css">
|
href="<?php echo $this->config->item('base_url'); ?>/assets/ext/bootstrap/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" type="text/css"
|
<link rel="stylesheet" type="text/css"
|
||||||
href="<?php echo $this->config->item('base_url'); ?>/assets/css/frontend.css">
|
href="<?php echo $this->config->item('base_url'); ?>/assets/css/frontend.css">
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// SET PAGE FAVICON
|
// SET PAGE FAVICON
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<link rel="icon" type="image/x-icon"
|
<link rel="icon" type="image/x-icon"
|
||||||
href="<?php echo $this->config->item('base_url'); ?>/assets/img/favicon.ico">
|
href="<?php echo $this->config->item('base_url'); ?>/assets/img/favicon.ico">
|
||||||
|
|
||||||
|
@ -74,11 +74,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// INCLUDE JS FILES
|
// INCLUDE JS FILES
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<script
|
<script
|
||||||
type="text/javascript"
|
type="text/javascript"
|
||||||
src="<?php echo $this->config->item('base_url'); ?>/assets/ext/jquery/jquery.min.js"></script>
|
src="<?php echo $this->config->item('base_url'); ?>/assets/ext/jquery/jquery.min.js"></script>
|
||||||
|
@ -96,6 +96,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// CUSTOM PAGE JS
|
// CUSTOM PAGE JS
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var GlobalVariables = {
|
var GlobalVariables = {
|
||||||
'csrfToken' : <?php echo json_encode($this->security->get_csrf_hash()); ?>,
|
'csrfToken' : <?php echo json_encode($this->security->get_csrf_hash()); ?>,
|
||||||
|
@ -118,5 +119,7 @@
|
||||||
<script
|
<script
|
||||||
type="text/javascript"
|
type="text/javascript"
|
||||||
src="<?php echo $this->config->item('base_url'); ?>/assets/js/general_functions.js"></script>
|
src="<?php echo $this->config->item('base_url'); ?>/assets/js/general_functions.js"></script>
|
||||||
|
|
||||||
|
<?php google_analytics_script(); ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// INCLUDE CSS FILES
|
// INCLUDE CSS FILES
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css"
|
<link rel="stylesheet" type="text/css"
|
||||||
href="<?php echo $this->config->item('base_url'); ?>/assets/ext/bootstrap/css/bootstrap.css">
|
href="<?php echo $this->config->item('base_url'); ?>/assets/ext/bootstrap/css/bootstrap.css">
|
||||||
<link rel="stylesheet" type="text/css"
|
<link rel="stylesheet" type="text/css"
|
||||||
|
@ -20,6 +21,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// SET PAGE FAVICON
|
// SET PAGE FAVICON
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<link rel="icon" type="image/x-icon"
|
<link rel="icon" type="image/x-icon"
|
||||||
href="<?php echo $this->config->item('base_url'); ?>/assets/img/favicon.ico">
|
href="<?php echo $this->config->item('base_url'); ?>/assets/img/favicon.ico">
|
||||||
|
|
||||||
|
@ -30,6 +32,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// CUSTOM PAGE JS
|
// CUSTOM PAGE JS
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var EALang = <?php echo json_encode($this->lang->language); ?>;
|
var EALang = <?php echo json_encode($this->lang->language); ?>;
|
||||||
</script>
|
</script>
|
||||||
|
@ -38,6 +41,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// INCLUDE JS FILES
|
// INCLUDE JS FILES
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<script
|
<script
|
||||||
type="text/javascript"
|
type="text/javascript"
|
||||||
src="<?php echo $this->config->item('base_url'); ?>/assets/ext/jquery/jquery.min.js"></script>
|
src="<?php echo $this->config->item('base_url'); ?>/assets/ext/jquery/jquery.min.js"></script>
|
||||||
|
@ -68,7 +72,6 @@
|
||||||
|
|
||||||
<div class="col-xs-12 col-sm-10">
|
<div class="col-xs-12 col-sm-10">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo '<h3>' . $message_title . '</h3>';
|
echo '<h3>' . $message_title . '</h3>';
|
||||||
echo '<p>' . $message_text . '</p>';
|
echo '<p>' . $message_text . '</p>';
|
||||||
|
|
||||||
|
@ -87,5 +90,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php google_analytics_script(); ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// INCLUDE CSS FILES
|
// INCLUDE CSS FILES
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<link
|
<link
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
type="text/css"
|
type="text/css"
|
||||||
|
@ -20,6 +21,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// SET PAGE FAVICON
|
// SET PAGE FAVICON
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<link
|
<link
|
||||||
rel="icon"
|
rel="icon"
|
||||||
type="image/x-icon"
|
type="image/x-icon"
|
||||||
|
@ -29,6 +31,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// CUSTOM PAGE JS
|
// CUSTOM PAGE JS
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var EALang = <?php echo json_encode($this->lang->language); ?>;
|
var EALang = <?php echo json_encode($this->lang->language); ?>;
|
||||||
</script>
|
</script>
|
||||||
|
@ -37,6 +40,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// INCLUDE JS FILES
|
// INCLUDE JS FILES
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<script
|
<script
|
||||||
type="text/javascript"
|
type="text/javascript"
|
||||||
src="<?php echo $this->config->item('base_url'); ?>/assets/ext/jquery/jquery.min.js"></script>
|
src="<?php echo $this->config->item('base_url'); ?>/assets/ext/jquery/jquery.min.js"></script>
|
||||||
|
@ -54,6 +58,7 @@
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// CUSTOM PAGE CSS
|
// CUSTOM PAGE CSS
|
||||||
// ------------------------------------------------------------ ?>
|
// ------------------------------------------------------------ ?>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
|
@ -112,7 +117,8 @@
|
||||||
<span class="glyphicon glyphicon-wrench"></span>
|
<span class="glyphicon glyphicon-wrench"></span>
|
||||||
<?php echo $this->lang->line('backend_section'); ?>
|
<?php echo $this->lang->line('backend_section'); ?>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php google_analytics_script(); ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue