Skip to content

Commit

Permalink
Release 1.4.5 - 1.4 with GA4 fix (#1469)
Browse files Browse the repository at this point in the history
* Update version.php to 1.4.5 alpha

* update files with patch from @skenow
  • Loading branch information
fiammybe committed Jul 4, 2023
1 parent 111d782 commit 5e1ac1a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
6 changes: 3 additions & 3 deletions htdocs/include/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @version $Id: version.php 12500 2015-06-15 20:03:56Z fiammy $
*/

define('ICMS_VERSION_NAME', 'ImpressCMS 1.4.4');
define('ICMS_VERSION_NAME', 'ImpressCMS 1.4.5 Aplha');

// For backward compatibility with XOOPS
define('XOOPS_VERSION', ICMS_VERSION_NAME);
Expand All @@ -23,7 +23,7 @@
* 10 = Final
*/

define('ICMS_VERSION_STATUS', 10);
define('ICMS_VERSION_STATUS', 1);

/**
* Build number
Expand All @@ -32,7 +32,7 @@
*/
// impresscms_1.3.10 = 82, 2.0.0 alpha 4 = 73, 1.4,1 beta : 94, 1.4.3 = 103

define('ICMS_VERSION_BUILD', 104);
define('ICMS_VERSION_BUILD', 105);

/**
* Latest dbversion of the System Module
Expand Down
2 changes: 2 additions & 0 deletions htdocs/libraries/icms/view/theme/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public function xoInit($options = array()) {
$this->addMeta('meta', substr($name, 5), $value);
} elseif (substr($name, 0, 6) == 'footer') {
$values = $value;
/*
if ($icmsConfigMetaFooter['use_google_analytics'] == TRUE && isset($icmsConfigMetaFooter['google_analytics']) && $icmsConfigMetaFooter['google_analytics'] != '') {
$values = $value . "<script>
Expand All @@ -223,6 +224,7 @@ public function xoInit($options = array()) {
</script>";
}
*/
$this->template->assign("xoops_$name", $values);
$this->template->assign("icms_$name", $values);
} else {
Expand Down
43 changes: 43 additions & 0 deletions htdocs/plugins/preloads/googleanalytics.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* googleanalytics ga4.php
* Created by david on 13/02/2022 22:41
* Modified by skenow on 11 June 2024
*/

/**
* preload class to include the Google Analytics V4 tag in the Head of the webpage, after replacing the smarty variable with the GA4 property code
* This can certainly be improved by checking whether we can, based on the preferences by our users (GDPR and cookies)
*/
class IcmsPreloadGa4 extends IcmsPreloadItem {

function eventBeforeFooter() {
global $xoopsTpl;
global $icmsTheme;
global $icmsConfigMetaFooter;
global $xoTheme;

try {

if ($icmsConfigMetaFooter['use_google_analytics'] == TRUE && isset($icmsConfigMetaFooter['google_analytics']) && $icmsConfigMetaFooter['google_analytics'] != '') {
if (substr($icmsConfigMetaFooter['google_analytics'], 0, 2 ) === "G-") {
$tagvalue = $icmsConfigMetaFooter['google_analytics'];
} else {
$tagvalue = 'UA-' . $icmsConfigMetaFooter['google_analytics'];
}
$xoTheme->addScript('https://www.googletagmanager.com/gtag/js?id=' . $tagvalue, ['async'=>'async'], '', 'module', 2000);
$xoTheme->addScript('', '', 'window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(\'js\', new Date());
gtag(\'config\', \'' . $tagvalue . '\');', 'module', '2001');
} else {
echo 'error getting icmsConfigMetaFooter';
}
}
catch (Exception $e) {
echo $e->getMessage();
}
}
}

0 comments on commit 5e1ac1a

Please sign in to comment.