From a4b8dad127ac9896eae0b4bf4540039661f2fbf7 Mon Sep 17 00:00:00 2001 From: filesite Date: Sat, 7 Jun 2025 21:43:47 +0800 Subject: [PATCH] ga conversion support --- conf/app.php | 2 +- plugins/Html.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/app.php b/conf/app.php index 191c84f..680c56e 100644 --- a/conf/app.php +++ b/conf/app.php @@ -202,7 +202,7 @@ $configs = array( //Google Adwords conversion配置 //示例:{'controller': 'xx', 'action': 'yy', 'send_to': 'zzz'} - 'GA_MEASUREMENT_CONVERSIONS' => [], + 'GA_MEASUREMENT_CONVERSIONS' => array(), //密码授权默认关闭 "password_auth" => array( diff --git a/plugins/Html.php b/plugins/Html.php index dd4cf35..769a5a5 100644 --- a/plugins/Html.php +++ b/plugins/Html.php @@ -125,12 +125,12 @@ eof; } - if (!empty(FSC::$app['config']['GA_MEASUREMENT_CONVERSIONS'])) { - $conversions = FSC::$app['config']['GA_MEASUREMENT_CONVERSIONS']; + $conversions = !empty(FSC::$app['config']['GA_MEASUREMENT_CONVERSIONS']) ? FSC::$app['config']['GA_MEASUREMENT_CONVERSIONS'] : array(); + if (!empty($conversions)) { //格式:{'controller': 'xx', 'action': 'yy', 'send_to': 'zzz'} foreach ($conversions as $item) { if (FSC::$app['controller'] == $item['controller'] && FSC::$app['action'] == $item['action']) { - gacode .= <<