迁移
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<script setup>
|
||||
import LandingB from '~/components/landing-b/LandingB.vue'
|
||||
import { onBeforeMount, onBeforeUnmount } from 'vue'
|
||||
import { useEventTracker, getSessionTraceId } from '~/utils/useEventTracker'
|
||||
import { getLandingVersion } from '~/utils/landingVersion'
|
||||
|
||||
// 独立 /b 入口:固定 B,保证 getButtonList 带 version=B
|
||||
getLandingVersion({}, '/b')
|
||||
|
||||
const LANDING_PAGE_ID = 'JHA-209-B'
|
||||
const { trackLandingPageView, trackLandingPageClick, generateSessionId } = useEventTracker()
|
||||
|
||||
const handleClick = (e) => {
|
||||
const rawText =
|
||||
e?.target?.closest?.('[data-track]')?.getAttribute('data-track') ||
|
||||
e?.target?.alt ||
|
||||
e?.target?.innerText ||
|
||||
''
|
||||
const tabKey = rawText
|
||||
.replace(/[^A-Za-z0-9_一-鿿]/g, '_')
|
||||
.replace(/_{2,}/g, '_')
|
||||
.replace(/^_+|_+$/g, '') || ''
|
||||
const isDownload = tabKey.toLowerCase() === 'download'
|
||||
trackLandingPageClick({
|
||||
landing_page_id: LANDING_PAGE_ID,
|
||||
tab_key: tabKey,
|
||||
tab_name: rawText,
|
||||
click_coordinates_x: e.clientX,
|
||||
click_coordinates_y: e.clientY,
|
||||
click_x_percent: Math.round((e.clientX / window.innerWidth) * 100),
|
||||
click_y_percent: Math.round((e.clientY / window.innerHeight) * 100),
|
||||
screen_width: window.innerWidth,
|
||||
screen_height: window.innerHeight,
|
||||
trace_id: isDownload ? getSessionTraceId() : generateSessionId(),
|
||||
})
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
trackLandingPageView({ landing_page_id: LANDING_PAGE_ID })
|
||||
window.addEventListener('click', handleClick)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('click', handleClick)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<LandingB />
|
||||
</template>
|
||||
Reference in New Issue
Block a user