diff --git a/application/helpers/google_analytics_helper.php b/application/helpers/google_analytics_helper.php index 6d26abe1..8229c4eb 100644 --- a/application/helpers/google_analytics_helper.php +++ b/application/helpers/google_analytics_helper.php @@ -26,9 +26,12 @@ function google_analytics_script() $google_analytics_code = $CI->settings_model->get_setting('google_analytics_code'); - if ($google_analytics_code !== '') - { - echo ' + 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/english/translations_lang.php b/application/language/english/translations_lang.php index ea5b1ff9..a9aadce4 100755 --- a/application/language/english/translations_lang.php +++ b/application/language/english/translations_lang.php @@ -283,7 +283,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.'; +$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['availabilities_type'] = 'Availabilities Type'; $lang['flexible'] = 'Flexible'; $lang['fixed'] = 'Fixed'; diff --git a/application/views/backend/settings.php b/application/views/backend/settings.php index 044caaef..f3b758ad 100755 --- a/application/views/backend/settings.php +++ b/application/views/backend/settings.php @@ -149,7 +149,7 @@