diff --git a/src/components/ChooseFood.vue b/src/components/ChooseFood.vue index 0000406..5973e80 100644 --- a/src/components/ChooseFood.vue +++ b/src/components/ChooseFood.vue @@ -36,9 +36,9 @@ const gtm = useGtm() const toggleStuff = (item: StuffItem, category = '') => { gtm?.trackEvent({ - event: 'stuff', + event: 'click', category: `${category}_${item.name}`, - action: 'click', + action: 'click_stuff', label: '食材', }) @@ -54,9 +54,9 @@ const clickTool = (item: StuffItem) => { rStore.toggleTools(value) gtm?.trackEvent({ - event: 'stuff', + event: 'click', category: `tool_${value}`, - action: 'click', + action: 'click_tool', label: '工具', }) } @@ -151,7 +151,7 @@ const clickTool = (item: StuffItem) => { --> -
+

🍲 今天的菜
diff --git a/src/components/DishTag.vue b/src/components/DishTag.vue index 9a8d05c..ce58aaa 100644 --- a/src/components/DishTag.vue +++ b/src/components/DishTag.vue @@ -9,9 +9,9 @@ const gtm = useGtm() const triggerGtm = (val: string) => { gtm?.trackEvent({ - event: 'recipe', + event: 'click', category: `dish_${val}`, - action: 'click', + action: 'click_recipe', label: '跳转菜谱', }) } diff --git a/src/modules/gtm.ts b/src/modules/gtm.ts index 25f4da9..e865afd 100644 --- a/src/modules/gtm.ts +++ b/src/modules/gtm.ts @@ -3,5 +3,8 @@ import type { UserModule } from '~/types' export const install: UserModule = ({ app }) => { // add google tag manager, and add GA4 in gtag - app.use(createGtm({ id: 'GTM-5FJSV46' })) + app.use(createGtm({ + id: 'GTM-5FJSV46', + debug: true, + })) }