From 59c44994f7fe5eefff8d807d35f98ea8e9d1b29b Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Wed, 19 Jan 2022 10:18:00 +0100 Subject: [PATCH] Add custom Matomo analytics integration (#974). --- application/config/autoload.php | 1 - application/controllers/Booking.php | 12 +++- .../controllers/Booking_cancellation.php | 2 + .../controllers/Booking_confirmation.php | 2 + .../helpers/google_analytics_helper.php | 59 ------------------- .../language/arabic/translations_lang.php | 1 + .../language/bulgarian/translations_lang.php | 1 + .../language/catalan/translations_lang.php | 1 + .../language/chinese/translations_lang.php | 1 + .../language/czech/translations_lang.php | 1 + .../language/danish/translations_lang.php | 1 + .../language/dutch/translations_lang.php | 1 + .../language/english/translations_lang.php | 3 +- .../language/finnish/translations_lang.php | 1 + .../language/french/translations_lang.php | 1 + .../language/german/translations_lang.php | 2 +- .../language/greek/translations_lang.php | 3 +- .../language/hebrew/translations_lang.php | 1 + .../language/hindi/translations_lang.php | 1 + .../language/hungarian/translations_lang.php | 1 + .../language/italian/translations_lang.php | 1 + .../language/japanese/translations_lang.php | 1 + .../luxembourgish/translations_lang.php | 1 + .../language/marathi/translations_lang.php | 1 + .../language/polish/translations_lang.php | 1 + .../portuguese-br/translations_lang.php | 1 + .../language/portuguese/translations_lang.php | 1 + .../language/romanian/translations_lang.php | 1 + .../language/russian/translations_lang.php | 1 + .../language/slovak/translations_lang.php | 1 + .../language/spanish/translations_lang.php | 1 + .../language/swedish/translations_lang.php | 1 + .../language/turkish/translations_lang.php | 1 + .../028_add_matomo_analytics_url_setting.php | 41 +++++++++++++ .../components/google_analytics_script.php | 27 +++++++++ .../components/matomo_analytics_script.php | 24 ++++++++ application/views/layouts/booking_layout.php | 3 +- application/views/layouts/message_layout.php | 3 +- application/views/pages/general_settings.php | 15 ++++- 39 files changed, 154 insertions(+), 68 deletions(-) delete mode 100644 application/helpers/google_analytics_helper.php create mode 100644 application/migrations/028_add_matomo_analytics_url_setting.php create mode 100644 application/views/components/google_analytics_script.php create mode 100644 application/views/components/matomo_analytics_script.php diff --git a/application/config/autoload.php b/application/config/autoload.php index 2b19cbf1..8a70889a 100644 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -71,7 +71,6 @@ $autoload['helper'] = [ 'debug', 'env', 'file', - 'google_analytics', 'html', 'http', 'installation', diff --git a/application/controllers/Booking.php b/application/controllers/Booking.php index 8f189d0a..34959f47 100755 --- a/application/controllers/Booking.php +++ b/application/controllers/Booking.php @@ -104,6 +104,8 @@ class Booking extends EA_Controller { $privacy_policy_content = setting('privacy_policy_content'); $display_any_provider = setting('display_any_provider'); $book_advance_timeout = setting('book_advance_timeout'); + $google_analytics_code = setting('google_analytics_code'); + $matomo_analytics_url = setting('matomo_analytics_url'); $timezones = $this->timezones->to_array(); $grouped_timezones = $this->timezones->to_grouped_array(); @@ -123,7 +125,9 @@ class Booking extends EA_Controller { 'page_title' => lang('page_title') . ' ' . $company_name, 'message_title' => lang('appointment_not_found'), 'message_text' => lang('appointment_does_not_exist_in_db'), - 'message_icon' => base_url('assets/img/error.png') + 'message_icon' => base_url('assets/img/error.png'), + 'google_analytics_code' => $google_analytics_code, + 'matomo_analytics_url' => $matomo_analytics_url ]); $this->load->view('pages/booking_message', html_vars()); @@ -150,7 +154,9 @@ class Booking extends EA_Controller { 'message_text' => strtr(lang('appointment_locked_message'), [ '{$limit}' => sprintf('%02d:%02d', $hours, $minutes) ]), - 'message_icon' => base_url('assets/img/error.png') + 'message_icon' => base_url('assets/img/error.png'), + 'google_analytics_code' => $google_analytics_code, + 'matomo_analytics_url' => $matomo_analytics_url ]); $this->load->view('pages/booking_message', html_vars()); @@ -216,6 +222,8 @@ class Booking extends EA_Controller { 'display_privacy_policy' => $display_privacy_policy, 'privacy_policy_content' => $privacy_policy_content, 'display_any_provider' => $display_any_provider, + 'google_analytics_code' => $google_analytics_code, + 'matomo_analytics_url' => $matomo_analytics_url, 'timezones' => $timezones, 'grouped_timezones' => $grouped_timezones, 'manage_mode' => $manage_mode, diff --git a/application/controllers/Booking_cancellation.php b/application/controllers/Booking_cancellation.php index 6c113cc7..b6de9364 100755 --- a/application/controllers/Booking_cancellation.php +++ b/application/controllers/Booking_cancellation.php @@ -95,6 +95,8 @@ class Booking_cancellation extends EA_Controller { 'message_title' => lang('appointment_cancelled_title'), 'message_text' => lang('appointment_cancelled'), 'message_icon' => base_url('assets/img/success.png'), + 'google_analytics_code' => setting('google_analytics_code'), + 'matomo_analytics_url' => setting('matomo_analytics_url'), 'exceptions' => $exceptions ]); diff --git a/application/controllers/Booking_confirmation.php b/application/controllers/Booking_confirmation.php index a1565778..72a12280 100755 --- a/application/controllers/Booking_confirmation.php +++ b/application/controllers/Booking_confirmation.php @@ -86,6 +86,8 @@ class Booking_confirmation extends EA_Controller { html_vars([ 'page_title' => lang('success'), + 'google_analytics_code' => setting('google_analytics_code'), + 'matomo_analytics_url' => setting('matomo_analytics_url'), ]); $this->load->view('pages/booking_confirmation', html_vars()); diff --git a/application/helpers/google_analytics_helper.php b/application/helpers/google_analytics_helper.php deleted file mode 100644 index 96be672e..00000000 --- a/application/helpers/google_analytics_helper.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @copyright Copyright (c) Alex Tselegidis - * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link https://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() -{ - $google_analytics_code = setting('google_analytics_code'); - - if ($google_analytics_code !== '') - { - - // If the Google Analytics code starts with UA then it is a Universal Analytics Property and the script stays - // the legacy one. - if (substr($google_analytics_code, 0, 2) === 'UA') - { - echo ' - - '; - } - - // If the Google Analytics code starts with a G then it is a Google Analytics 4-Property and the script - // to inject it looks different. - if (substr($google_analytics_code, 0, 2) === 'G-') - { - echo ' - - - '; - } - } -} diff --git a/application/language/arabic/translations_lang.php b/application/language/arabic/translations_lang.php index 17239f77..a0e907c1 100755 --- a/application/language/arabic/translations_lang.php +++ b/application/language/arabic/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/bulgarian/translations_lang.php b/application/language/bulgarian/translations_lang.php index 8deaad12..ba1eba30 100755 --- a/application/language/bulgarian/translations_lang.php +++ b/application/language/bulgarian/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/catalan/translations_lang.php b/application/language/catalan/translations_lang.php index 89eb61b5..e80a8b48 100644 --- a/application/language/catalan/translations_lang.php +++ b/application/language/catalan/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/chinese/translations_lang.php b/application/language/chinese/translations_lang.php index 9871cbc2..90f8b55c 100755 --- a/application/language/chinese/translations_lang.php +++ b/application/language/chinese/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/czech/translations_lang.php b/application/language/czech/translations_lang.php index 94f1601d..868aaa04 100644 --- a/application/language/czech/translations_lang.php +++ b/application/language/czech/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/danish/translations_lang.php b/application/language/danish/translations_lang.php index cbbc6d94..50f299c5 100755 --- a/application/language/danish/translations_lang.php +++ b/application/language/danish/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/dutch/translations_lang.php b/application/language/dutch/translations_lang.php index 6de36dea..98bca284 100755 --- a/application/language/dutch/translations_lang.php +++ b/application/language/dutch/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/english/translations_lang.php b/application/language/english/translations_lang.php index 088c1e37..f5f79abf 100755 --- a/application/language/english/translations_lang.php +++ b/application/language/english/translations_lang.php @@ -286,7 +286,7 @@ $lang['time_format'] = 'Time Format'; $lang['time_format_hint'] = 'Change the time display format (H - Hours, M - Minutes).'; $lang['first_weekday'] = 'First day of week'; $lang['first_weekday_hint'] = 'Set the first day of the calendar week.'; -$lang['google_analytics_code_hint'] = 'Add your Google Analytics ID to be included in the booking page. You can use the tracking id or measurement id.'; +$lang['google_analytics_code_hint'] = 'Add your Google Analytics Code to enable Google Analytics tracking on the booking pages.'; $lang['availabilities_type'] = 'Availabilities Type'; $lang['flexible'] = 'Flexible'; $lang['fixed'] = 'Fixed'; @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/finnish/translations_lang.php b/application/language/finnish/translations_lang.php index ad91a0cd..c81697fe 100755 --- a/application/language/finnish/translations_lang.php +++ b/application/language/finnish/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/french/translations_lang.php b/application/language/french/translations_lang.php index 59bf3700..9b181bf7 100755 --- a/application/language/french/translations_lang.php +++ b/application/language/french/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/german/translations_lang.php b/application/language/german/translations_lang.php index 3d80fb7d..9f5c8b1a 100755 --- a/application/language/german/translations_lang.php +++ b/application/language/german/translations_lang.php @@ -282,7 +282,7 @@ $lang['time_format'] = 'Zeitformat'; $lang['time_format_hint'] = 'Ändern Sie das Zeitanzeigeformat (H - Stunden, M - Minuten).'; $lang['first_weekday'] = 'Erster Tag der Woche'; $lang['first_weekday_hint'] = 'Wählen Sie den ersten Tag der Kalenderwoche.'; -$lang['google_analytics_code_hint'] = 'Fügen Sie Ihre Google Analytics-ID hinzu, das auf der Buchungsseite enthalten wird.'; +$lang['google_analytics_code_hint'] = 'Fügen Sie Ihre Google Analytics-Code hinzu, um das Google Analytics tracking auf den Buchungsseiten zu aktivieren.'; $lang['availabilities_type'] = 'Verfügungstyp'; $lang['flexible'] = 'Flexibel'; $lang['fixed'] = 'Fest'; diff --git a/application/language/greek/translations_lang.php b/application/language/greek/translations_lang.php index 1477cb18..8372360d 100755 --- a/application/language/greek/translations_lang.php +++ b/application/language/greek/translations_lang.php @@ -286,7 +286,7 @@ $lang['time_format'] = 'Μορφή Ώρας'; $lang['time_format_hint'] = 'Αλλάξτε την μορφή ώρας (H - Ώρα, M - Λεπτά).'; $lang['first_weekday'] = 'Πρώτη ημέρα της εβδομάδας'; $lang['first_weekday_hint'] = 'Καθορίστε την πρώτη ημέρα της εβδομάδας στο ημερολόγιο.'; -$lang['google_analytics_code_hint'] = 'Προσθέστε τον Google Analytics ID σας το οποίο θα συμπεριληφθεί στην σελίδα κράτησης.'; +$lang['google_analytics_code_hint'] = 'Προσθέστε τον Google Analytics Code σας για να ενεργοποιήσετε το Google Analytics tracking στις σελίδες κράτησης.'; $lang['availabilities_type'] = 'Τύπος Διαθεσιμοτήτων'; $lang['flexible'] = 'Ευέλικτος'; $lang['fixed'] = 'Σταθερός'; @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/hebrew/translations_lang.php b/application/language/hebrew/translations_lang.php index 6cc90463..f7762590 100644 --- a/application/language/hebrew/translations_lang.php +++ b/application/language/hebrew/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/hindi/translations_lang.php b/application/language/hindi/translations_lang.php index f482cc42..7f9be4be 100755 --- a/application/language/hindi/translations_lang.php +++ b/application/language/hindi/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/hungarian/translations_lang.php b/application/language/hungarian/translations_lang.php index 4f77a931..ce9b63fd 100755 --- a/application/language/hungarian/translations_lang.php +++ b/application/language/hungarian/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/italian/translations_lang.php b/application/language/italian/translations_lang.php index a7fecdad..0b40ba8e 100755 --- a/application/language/italian/translations_lang.php +++ b/application/language/italian/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/japanese/translations_lang.php b/application/language/japanese/translations_lang.php index 59156baf..1655c6b9 100755 --- a/application/language/japanese/translations_lang.php +++ b/application/language/japanese/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/luxembourgish/translations_lang.php b/application/language/luxembourgish/translations_lang.php index 3421b65a..b55f74b1 100755 --- a/application/language/luxembourgish/translations_lang.php +++ b/application/language/luxembourgish/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/marathi/translations_lang.php b/application/language/marathi/translations_lang.php index e8f1fd3b..65110e70 100644 --- a/application/language/marathi/translations_lang.php +++ b/application/language/marathi/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/polish/translations_lang.php b/application/language/polish/translations_lang.php index a381257c..61cad48e 100755 --- a/application/language/polish/translations_lang.php +++ b/application/language/polish/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/portuguese-br/translations_lang.php b/application/language/portuguese-br/translations_lang.php index 314f45bb..60c45a53 100755 --- a/application/language/portuguese-br/translations_lang.php +++ b/application/language/portuguese-br/translations_lang.php @@ -336,4 +336,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/portuguese/translations_lang.php b/application/language/portuguese/translations_lang.php index cc911a00..89278651 100755 --- a/application/language/portuguese/translations_lang.php +++ b/application/language/portuguese/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/romanian/translations_lang.php b/application/language/romanian/translations_lang.php index 5e4bf6ca..773c1b08 100755 --- a/application/language/romanian/translations_lang.php +++ b/application/language/romanian/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/russian/translations_lang.php b/application/language/russian/translations_lang.php index 36c690ff..e704b93a 100755 --- a/application/language/russian/translations_lang.php +++ b/application/language/russian/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/slovak/translations_lang.php b/application/language/slovak/translations_lang.php index 9475f9d5..1837d6c2 100755 --- a/application/language/slovak/translations_lang.php +++ b/application/language/slovak/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/spanish/translations_lang.php b/application/language/spanish/translations_lang.php index 0068e5f1..d9ece108 100755 --- a/application/language/spanish/translations_lang.php +++ b/application/language/spanish/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/swedish/translations_lang.php b/application/language/swedish/translations_lang.php index 88f8127f..058b6046 100644 --- a/application/language/swedish/translations_lang.php +++ b/application/language/swedish/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/language/turkish/translations_lang.php b/application/language/turkish/translations_lang.php index 2c6da116..a061e24d 100755 --- a/application/language/turkish/translations_lang.php +++ b/application/language/turkish/translations_lang.php @@ -337,4 +337,5 @@ $lang['booking_settings'] = 'Booking Settings'; $lang['display'] = 'Display'; $lang['require'] = 'Require'; $lang['color'] = 'Color'; +$lang['matomo_analytics_url_hint'] = 'Add the URL to your own Matomo installation to enable Matomo tracking on the booking pages.'; // End diff --git a/application/migrations/028_add_matomo_analytics_url_setting.php b/application/migrations/028_add_matomo_analytics_url_setting.php new file mode 100644 index 00000000..9fa3ed07 --- /dev/null +++ b/application/migrations/028_add_matomo_analytics_url_setting.php @@ -0,0 +1,41 @@ + + * @copyright Copyright (c) Alex Tselegidis + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org + * @since v1.4.0 + * ---------------------------------------------------------------------------- */ + +class Migration_Add_matomo_analytics_url_setting extends EA_Migration { + /** + * Upgrade method. + */ + public function up() + { + if ( ! $this->db->get_where('settings', ['name' => 'matomo_analytics_url'])->num_rows()) + { + $this->db->insert('settings', [ + 'name' => 'matomo_analytics_url', + 'value' => '' + ]); + } + } + + /** + * Downgrade method. + */ + public function down() + { + if ( ! $this->db->get_where('settings', ['name' => 'matomo_analytics_url'])->num_rows()) + { + $this->db->delete('settings', [ + 'name' => 'matomo_analytics_url', + ]); + } + } +} diff --git a/application/views/components/google_analytics_script.php b/application/views/components/google_analytics_script.php new file mode 100644 index 00000000..54473830 --- /dev/null +++ b/application/views/components/google_analytics_script.php @@ -0,0 +1,27 @@ + + + + + + + + + + + diff --git a/application/views/components/matomo_analytics_script.php b/application/views/components/matomo_analytics_script.php new file mode 100644 index 00000000..8735decc --- /dev/null +++ b/application/views/components/matomo_analytics_script.php @@ -0,0 +1,24 @@ + + + + diff --git a/application/views/layouts/booking_layout.php b/application/views/layouts/booking_layout.php index 404ababb..4d580026 100644 --- a/application/views/layouts/booking_layout.php +++ b/application/views/layouts/booking_layout.php @@ -71,7 +71,8 @@ - + vars('google_analytics_code')]) ?> + vars('matomo_analytics_url')]) ?> diff --git a/application/views/layouts/message_layout.php b/application/views/layouts/message_layout.php index 2accea92..212f3cd9 100644 --- a/application/views/layouts/message_layout.php +++ b/application/views/layouts/message_layout.php @@ -62,7 +62,8 @@ - + vars('google_analytics_code')]) ?> + vars('matomo_analytics_url')]) ?> diff --git a/application/views/pages/general_settings.php b/application/views/pages/general_settings.php index 7118a158..3c2240b8 100755 --- a/application/views/pages/general_settings.php +++ b/application/views/pages/general_settings.php @@ -111,7 +111,8 @@
+ Google Analytics Code +
@@ -120,6 +121,18 @@
+
+ + +
+ + + +
+