mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-12-22 14:42:23 +03:00
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 {
|
||||
$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
|
||||
// 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.
|
||||
$manage_mode = TRUE;
|
||||
|
||||
|
@ -107,8 +110,6 @@ class Appointments extends CI_Controller {
|
|||
$customer = array();
|
||||
}
|
||||
|
||||
$google_analytics_code = $this->settings_model->get_setting('google_analytics_code');
|
||||
|
||||
// Load the book appointment view.
|
||||
$view = array (
|
||||
'available_services' => $available_services,
|
||||
|
@ -118,8 +119,7 @@ class Appointments extends CI_Controller {
|
|||
'date_format' => $date_format,
|
||||
'appointment_data' => $appointment,
|
||||
'provider_data' => $provider,
|
||||
'customer_data' => $customer,
|
||||
'google_analytics_code' => $google_analytics_code
|
||||
'customer_data' => $customer
|
||||
);
|
||||
} catch(Exception $exc) {
|
||||
$view['exceptions'][] = $exc;
|
||||
|
|
|
@ -37,6 +37,7 @@ class Errors extends CI_Controller {
|
|||
}
|
||||
|
||||
public function error404() {
|
||||
$this->load->helper('google_analytics');
|
||||
$this->load->model('settings_model');
|
||||
$view['company_name'] = $this->settings_model->get_setting('company_name');
|
||||
$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
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
|
@ -36,6 +37,7 @@
|
|||
// ------------------------------------------------------------
|
||||
// INCLUDE JAVASCRIPT FILES
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="<?php echo $this->config->item('base_url'); ?>/assets/ext/jquery/jquery.min.js"></script>
|
||||
|
@ -59,6 +61,7 @@
|
|||
// ------------------------------------------------------------
|
||||
// WEBPAGE FAVICON
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<link rel="icon" type="image/x-icon"
|
||||
href="<?php echo $this->config->item('base_url'); ?>/assets/img/favicon.ico">
|
||||
|
||||
|
@ -69,6 +72,7 @@
|
|||
// ------------------------------------------------------------
|
||||
// VIEW FILE JAVASCRIPT CODE
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
var GlobalVariables = {
|
||||
availableServices : <?php echo json_encode($available_services); ?>,
|
||||
|
@ -102,6 +106,7 @@
|
|||
// ------------------------------------------------------
|
||||
// FRAME TOP BAR
|
||||
// ------------------------------------------------------ ?>
|
||||
|
||||
<div id="header">
|
||||
<span id="company-name"><?php echo $company_name; ?></span>
|
||||
|
||||
|
@ -161,10 +166,12 @@
|
|||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
// ------------------------------------------------------
|
||||
// SELECT SERVICE AND PROVIDER
|
||||
// ------------------------------------------------------ ?>
|
||||
|
||||
<div id="wizard-frame-1" class="wizard-frame">
|
||||
<div class="frame-container">
|
||||
<h3 class="frame-title"><?php echo $this->lang->line('step_one_title'); ?></h3>
|
||||
|
@ -257,6 +264,7 @@
|
|||
// ------------------------------------------------------
|
||||
// SELECT APPOINTMENT DATE
|
||||
// ------------------------------------------------------ ?>
|
||||
|
||||
<div id="wizard-frame-2" class="wizard-frame" style="display:none;">
|
||||
<div class="frame-container">
|
||||
|
||||
|
@ -292,6 +300,7 @@
|
|||
// ------------------------------------------------------
|
||||
// ENTER CUSTOMER DATA
|
||||
// ------------------------------------------------------ ?>
|
||||
|
||||
<div id="wizard-frame-3" class="wizard-frame" style="display:none;">
|
||||
<div class="frame-container">
|
||||
|
||||
|
@ -357,6 +366,7 @@
|
|||
// ------------------------------------------------------
|
||||
// APPOINTMENT DATA CONFIRMATION
|
||||
// ------------------------------------------------------ ?>
|
||||
|
||||
<div id="wizard-frame-4" class="wizard-frame" style="display:none;">
|
||||
<div class="frame-container">
|
||||
<h3 class="frame-title"><?php echo $this->lang->line('step_four_title'); ?></h3>
|
||||
|
@ -403,6 +413,7 @@
|
|||
// ------------------------------------------------------
|
||||
// FRAME FOOTER
|
||||
// ------------------------------------------------------ ?>
|
||||
|
||||
<div id="frame-footer">
|
||||
Powered By
|
||||
<a href="http://easyappointments.org" target="_blank">Easy!Appointments</a>
|
||||
|
@ -425,15 +436,6 @@
|
|||
type="text/javascript"
|
||||
src="<?php echo $this->config->item('base_url'); ?>/assets/js/general_functions.js"></script>
|
||||
|
||||
<?php if ($google_analytics_code !== ''): ?>
|
||||
<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; ?>
|
||||
<?php google_analytics_script(); ?>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -7,21 +7,21 @@
|
|||
<meta name="theme-color" content="#35A768">
|
||||
<title><?php echo $this->lang->line('appointment_registered') . ' - ' . $company_name; ?></title>
|
||||
|
||||
|
||||
<?php
|
||||
// ------------------------------------------------------------
|
||||
// INCLUDE CSS FILES
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="<?php echo $this->config->item('base_url'); ?>/assets/ext/bootstrap/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="<?php echo $this->config->item('base_url'); ?>/assets/css/frontend.css">
|
||||
|
||||
|
||||
<?php
|
||||
// ------------------------------------------------------------
|
||||
// SET PAGE FAVICON
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<link rel="icon" type="image/x-icon"
|
||||
href="<?php echo $this->config->item('base_url'); ?>/assets/img/favicon.ico">
|
||||
|
||||
|
@ -74,11 +74,11 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
// ------------------------------------------------------------
|
||||
// INCLUDE JS FILES
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="<?php echo $this->config->item('base_url'); ?>/assets/ext/jquery/jquery.min.js"></script>
|
||||
|
@ -96,6 +96,7 @@
|
|||
// ------------------------------------------------------------
|
||||
// CUSTOM PAGE JS
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
var GlobalVariables = {
|
||||
'csrfToken' : <?php echo json_encode($this->security->get_csrf_hash()); ?>,
|
||||
|
@ -118,5 +119,7 @@
|
|||
<script
|
||||
type="text/javascript"
|
||||
src="<?php echo $this->config->item('base_url'); ?>/assets/js/general_functions.js"></script>
|
||||
|
||||
<?php google_analytics_script(); ?>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
// ------------------------------------------------------------
|
||||
// INCLUDE CSS FILES
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="<?php echo $this->config->item('base_url'); ?>/assets/ext/bootstrap/css/bootstrap.css">
|
||||
<link rel="stylesheet" type="text/css"
|
||||
|
@ -20,6 +21,7 @@
|
|||
// ------------------------------------------------------------
|
||||
// SET PAGE FAVICON
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<link rel="icon" type="image/x-icon"
|
||||
href="<?php echo $this->config->item('base_url'); ?>/assets/img/favicon.ico">
|
||||
|
||||
|
@ -30,6 +32,7 @@
|
|||
// ------------------------------------------------------------
|
||||
// CUSTOM PAGE JS
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
var EALang = <?php echo json_encode($this->lang->language); ?>;
|
||||
</script>
|
||||
|
@ -38,6 +41,7 @@
|
|||
// ------------------------------------------------------------
|
||||
// INCLUDE JS FILES
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<script
|
||||
type="text/javascript"
|
||||
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">
|
||||
<?php
|
||||
|
||||
echo '<h3>' . $message_title . '</h3>';
|
||||
echo '<p>' . $message_text . '</p>';
|
||||
|
||||
|
@ -87,5 +90,7 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php google_analytics_script(); ?>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
// ------------------------------------------------------------
|
||||
// INCLUDE CSS FILES
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
|
@ -20,6 +21,7 @@
|
|||
// ------------------------------------------------------------
|
||||
// SET PAGE FAVICON
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/x-icon"
|
||||
|
@ -29,6 +31,7 @@
|
|||
// ------------------------------------------------------------
|
||||
// CUSTOM PAGE JS
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
var EALang = <?php echo json_encode($this->lang->language); ?>;
|
||||
</script>
|
||||
|
@ -37,6 +40,7 @@
|
|||
// ------------------------------------------------------------
|
||||
// INCLUDE JS FILES
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="<?php echo $this->config->item('base_url'); ?>/assets/ext/jquery/jquery.min.js"></script>
|
||||
|
@ -54,6 +58,7 @@
|
|||
// ------------------------------------------------------------
|
||||
// CUSTOM PAGE CSS
|
||||
// ------------------------------------------------------------ ?>
|
||||
|
||||
<style>
|
||||
body {
|
||||
width: 100vw;
|
||||
|
@ -112,7 +117,8 @@
|
|||
<span class="glyphicon glyphicon-wrench"></span>
|
||||
<?php echo $this->lang->line('backend_section'); ?>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<?php google_analytics_script(); ?>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue