diff --git a/helpers/Layout.php b/helpers/Layout.php index 15fedcc903..6f4d4b3ab2 100644 --- a/helpers/Layout.php +++ b/helpers/Layout.php @@ -593,8 +593,8 @@ public static function getThemeStylesheet($target) */ public static function printAnalyticsCode(): void { - $gaTag = $_ENV['GA_TAG']; - $environment = $_ENV['NODE_ENV'] === 'production' ? 'Production' : 'Internal'; + $gaTag = $_ENV['GA_TAG'] ?? ''; + $environment = isset($_ENV['NODE_ENV']) && $_ENV['NODE_ENV'] === 'production' ? 'Production' : 'Internal'; if ($gaTag && method_exists(self::$templateClass, 'inc')) { call_user_func(