From fd40b538da54cd79afeb53875be5590b73a20873 Mon Sep 17 00:00:00 2001 From: filesite Date: Wed, 29 May 2024 22:05:40 +0800 Subject: [PATCH] add google adwords track support --- conf/app.php | 3 +++ plugins/Html.php | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/conf/app.php b/conf/app.php index 6d4f8b3..21671ac 100644 --- a/conf/app.php +++ b/conf/app.php @@ -136,6 +136,9 @@ $configs = array( //Google Analytics MEASUREMENT ID 'GA_MEASUREMENT_ID' => 'G-09MWT3Z9R0', + //Google Adwords目标跟踪ID + 'GAD_MEASUREMENT_ID' => '', + ); //自定义配置支持 diff --git a/plugins/Html.php b/plugins/Html.php index 08523ce..5448848 100644 --- a/plugins/Html.php +++ b/plugins/Html.php @@ -80,6 +80,8 @@ Class Html { $msid = !empty(FSC::$app['config']['GA_MEASUREMENT_ID']) ? FSC::$app['config']['GA_MEASUREMENT_ID'] : ''; if (empty($msid)) {return '';} + $adwords_id = !empty(FSC::$app['config']['GAD_MEASUREMENT_ID']) ? FSC::$app['config']['GAD_MEASUREMENT_ID'] : ''; + $gacode = << @@ -89,6 +91,15 @@ Class Html { gtag('js', new Date()); gtag('config', '{$msid}'); +eof; + + if (!empty($adwords_id)) { + $gacode .= << eof;