Merge branch 'add-ga4-support' of https://github.com/c0un7-z3r0/easyappointments into develop
# Conflicts: # application/language/german/translations_lang.php
This commit is contained in:
commit
f9bb741810
3 changed files with 23 additions and 5 deletions
|
@ -26,8 +26,11 @@ function google_analytics_script()
|
|||
|
||||
$google_analytics_code = $CI->settings_model->get_setting('google_analytics_code');
|
||||
|
||||
if ($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 '
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
|
||||
|
@ -39,4 +42,19 @@ function google_analytics_script()
|
|||
</script>
|
||||
';
|
||||
}
|
||||
|
||||
// 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 '
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=' . $google_analytics_code . '"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag("js", new Date());
|
||||
gtag("config", "' . $google_analytics_code . '");
|
||||
</script>
|
||||
';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -149,7 +149,7 @@
|
|||
<div class="form-group">
|
||||
<label for="google-analytics-code">
|
||||
Google Analytics ID</label>
|
||||
<input id="google-analytics-code" placeholder="UA-XXXXXXXX-XX"
|
||||
<input id="google-analytics-code" placeholder="UA-XXXXXXXX-XX or G-XXXXXXXXXX"
|
||||
data-field="google_analytics_code" class="form-control">
|
||||
<span class="help-block">
|
||||
<?= lang('google_analytics_code_hint') ?>
|
||||
|
|
Loading…
Reference in a new issue