From 0c7bb96acea21fe43ee9b926c699f20b21dd3a35 Mon Sep 17 00:00:00 2001
From: hejianhao <15708179461@qq.com>
Date: 星期一, 23 三月 2026 15:47:32 +0800
Subject: [PATCH] feat: 更新埋点配置并添加用户行为追踪
---
src/robotaxi/pages/begin-route/components/calling-car.tsx | 7 +
src/robotaxi/pages/site-search/index.tsx | 30 ---------
src/robotaxi/pages/begin-route/components/css-folder/evaluate-popup.less | 7 +-
config/prod.js | 4
src/pages/robotaxi/home/components/privacy-popup/index.tsx | 7 ++
src/robotaxi/pages/expense-description/index.tsx | 4
src/robotaxi/pages/expense-detail/index.tsx | 2
src/utils/Robotaxi-public-method.ts | 33 ++++++++++
src/pages/robotaxi/home/index.tsx | 15 ++++
src/robotaxi/pages/begin-route/index.tsx | 20 ++++--
10 files changed, 80 insertions(+), 49 deletions(-)
diff --git a/config/prod.js b/config/prod.js
index f63bc43..54b55c2 100644
--- a/config/prod.js
+++ b/config/prod.js
@@ -27,9 +27,9 @@
};
const GIO_CONFIG = {
- accountId: '"xxxxxxx"', // 埋点平台id
+ accountId: '"84eafaa69d23412f"', // 埋点平台id
dataSourceId: {
- weapp: '"xxxxxxx"', // 埋点数据源id
+ weapp: '"b9aa24dc0aab9edb"', // 埋点数据源id
},
host: '"https://collect.xiaopeng.com"',
}
diff --git a/src/pages/robotaxi/home/components/privacy-popup/index.tsx b/src/pages/robotaxi/home/components/privacy-popup/index.tsx
index f20b2ea..ddc2839 100644
--- a/src/pages/robotaxi/home/components/privacy-popup/index.tsx
+++ b/src/pages/robotaxi/home/components/privacy-popup/index.tsx
@@ -6,6 +6,7 @@
import uncheck from '../../../../../robotaxi/assets/uncheck.png'
import { privicyShowManager } from './utils'
import { submitAgreement } from '../../../../../robotaxi/api/home'
+import { reportEvent } from '../../../../../utils/Robotaxi-public-method'
type Props = {
show?: boolean;
@@ -54,6 +55,9 @@
}, [isAgree]);
const handleClose = () => {
+ reportEvent('RT_xcx_protocol_click', {
+ status_code: 0
+ })
privicyShowManager.setHasShow(false)
onClose?.();
};
@@ -64,6 +68,9 @@
return
};
submitAgreement({ type: [1, 2, 3, 4] }).then((res: any) => {
+ reportEvent('RT_xcx_protocol_click', {
+ status_code: 1
+ })
privicyShowManager.setHasShow(true)
onAgree?.();
}).catch(() => {
diff --git a/src/pages/robotaxi/home/index.tsx b/src/pages/robotaxi/home/index.tsx
index 6c29199..d70d862 100644
--- a/src/pages/robotaxi/home/index.tsx
+++ b/src/pages/robotaxi/home/index.tsx
@@ -23,7 +23,8 @@
getCityLocation,
getCityInfoWithId,
getLocationByIP,
- mapOrderStatusToTripStatus
+ mapOrderStatusToTripStatus,
+ reportEvent,
} from '../../../utils/Robotaxi-public-method';
import { jumpTo } from '../../../utils/jump';
import { _ROBOTAXI_WS_HOST, CDN } from '../../../constants/api';
@@ -1049,6 +1050,11 @@
Taro.setStorageSync('startSite', currentSite);
Taro.navigateTo({
url: '/robotaxi/pages/select-map-site/index?pageType=' + type,
+ success: () => {
+ reportEvent('RT_xcx_protocol_click', {
+ element_type: 'start'
+ })
+ }
})
return
}
@@ -1063,7 +1069,12 @@
Taro.setStorageSync('startSite', currentSite);
}
Taro.navigateTo({
- url: `/robotaxi/pages/site-search/index?pageType=${type}&electronicAreaId=${electronicAreaId}&longitude=${currentSite.longitude}&latitude=${currentSite.latitude}`
+ url: `/robotaxi/pages/site-search/index?pageType=${type}&electronicAreaId=${electronicAreaId}&longitude=${currentSite.longitude}&latitude=${currentSite.latitude}`,
+ success: () => {
+ reportEvent('RT_xcx_protocol_click', {
+ element_type: type == 'start' ? 'start' : 'dest',
+ })
+ }
})
}
diff --git a/src/robotaxi/pages/begin-route/components/calling-car.tsx b/src/robotaxi/pages/begin-route/components/calling-car.tsx
index 9f1c0fa..334d753 100644
--- a/src/robotaxi/pages/begin-route/components/calling-car.tsx
+++ b/src/robotaxi/pages/begin-route/components/calling-car.tsx
@@ -17,7 +17,8 @@
getTypeLabel,
formatMoney,
formatTripDistance,
- formatTripDurationFromSeconds
+ formatTripDurationFromSeconds,
+ reportEvent
} from '../../../../utils/Robotaxi-public-method';
import {
getWaitTime,
@@ -144,7 +145,9 @@
queryFareBreakdown(targetOrderId).then((res: any) => {
const data = res?.data ?? res?.result ?? res;
setFareBreakdown(data);
- }).catch(() => { });
+ }).catch(() => {
+ reportEvent('RT_xcx_dest_arrive_fail', {})
+ });
};
// 根据行程状态初始化等待/限停/倒计时/温度信息,并管理对应定时器
diff --git a/src/robotaxi/pages/begin-route/components/css-folder/evaluate-popup.less b/src/robotaxi/pages/begin-route/components/css-folder/evaluate-popup.less
index 1209b90..0016fab 100644
--- a/src/robotaxi/pages/begin-route/components/css-folder/evaluate-popup.less
+++ b/src/robotaxi/pages/begin-route/components/css-folder/evaluate-popup.less
@@ -139,7 +139,7 @@
width: 208px;
height: 208px;
border-radius: 16px;
- overflow: hidden;
+ // overflow: hidden;
background: rgba(0, 0, 0, 0.03);
}
@@ -190,9 +190,8 @@
&-delete {
position: absolute;
- top: 8px;
- right: 8px;
- box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
+ top: -10px;
+ right: -10px;
z-index: 2;
.delete-icon {
diff --git a/src/robotaxi/pages/begin-route/index.tsx b/src/robotaxi/pages/begin-route/index.tsx
index 87cf150..17c6889 100644
--- a/src/robotaxi/pages/begin-route/index.tsx
+++ b/src/robotaxi/pages/begin-route/index.tsx
@@ -22,7 +22,6 @@
import wsManager from '../../../utils/websocket';
import {
getWalkingRoute,
- formatDurationToClock,
formatDateTime,
clearOrderTripStorage,
preloadImageToTemp,
@@ -32,8 +31,8 @@
convertAdcodeToCityCode,
getCityInfoWithId,
getDistance,
- shouldUpdateRoute,
- mapOrderStatusToTripStatus
+ mapOrderStatusToTripStatus,
+ reportEvent
} from '../../../utils/Robotaxi-public-method';
import {
saveOrder,
@@ -922,7 +921,9 @@
orderRouteInitializedRef.current = true;
currentFullRouteRef.current = [...points];
lastErasedIndexRef.current = 0;
- applyRoutePoints(points);
+ Taro.nextTick(() => {
+ applyRoutePoints(points);
+ });
}
if (firstPoint && typeof firstPoint.latitude === 'number' && typeof firstPoint.longitude === 'number') {
updateVehicleLocationThrottled(firstPoint.latitude, firstPoint.longitude, true);
@@ -1684,7 +1685,7 @@
const waitingTime = Number(fareEstimate?.waitingTime || 0);
const estimatedTime = formatDateTime(new Date(Date.now() + waitingTime * 60 * 1000));
- const cachedCouponId = Taro.getStorageSync('selectedCouponId');
+ const cachedCouponId = Taro.getStorageSync('selectedCouponId') || '';
const payload: any = {
endPointId: endSite.id,
openCityId: openCityId,
@@ -1700,6 +1701,13 @@
}
try {
const res = await saveOrder(payload);
+ let status_code = res.orderId ? 1 : 0;
+ reportEvent('RT_xcx_order_submit', {
+ total_amount: fareEstimate.originalFare,
+ payable_amount: fareEstimate.finalFare,
+ coupon_id: cachedCouponId,
+ status_code: status_code,
+ })
if (typeof res == 'string') {
Taro.showToast({
title: res,
@@ -1708,7 +1716,7 @@
})
setTimeout(() => {
Taro.reLaunch({
- url: '/robotaxi/pages/begin-route/index',
+ url: '/pages/home/index',
})
}, 1500);
return
diff --git a/src/robotaxi/pages/expense-description/index.tsx b/src/robotaxi/pages/expense-description/index.tsx
index 3c1013a..ec1fbe9 100644
--- a/src/robotaxi/pages/expense-description/index.tsx
+++ b/src/robotaxi/pages/expense-description/index.tsx
@@ -212,14 +212,14 @@
{
(fareData.orderMoney && !fareData.couponMoney) &&
<View className='flex-between-card mt-16'>
- <View className='price-label'>系统优惠</View>
+ <View className='price-label'>限时优惠</View>
<View className='price-value color-red'>-{formatMoney(fareData.orderMoney)}元</View>
</View>
}
{
(fareData.orderMoney && fareData.couponMoney && fareData.orderMoney - fareData.couponMoney > 0) ?
<View className='flex-between-card mt-16'>
- <View className='price-label'>系统优惠</View>
+ <View className='price-label'>限时优惠</View>
<View className='price-value color-red'>-{formatMoney(fareData.orderMoney - fareData.couponMoney)}元</View>
</View>
: ''
diff --git a/src/robotaxi/pages/expense-detail/index.tsx b/src/robotaxi/pages/expense-detail/index.tsx
index 882cb45..0561a38 100644
--- a/src/robotaxi/pages/expense-detail/index.tsx
+++ b/src/robotaxi/pages/expense-detail/index.tsx
@@ -110,7 +110,7 @@
{
(pricingCard.systemDiscount && pricingCard.systemDiscount > 0) &&
<View className='flex-between-card'>
- <View className='price-label'>系统优惠</View>
+ <View className='price-label'>限时优惠</View>
<View className='price-value color-red'>-{pricingCard.systemDiscountStr}元</View>
</View>
}
diff --git a/src/robotaxi/pages/site-search/index.tsx b/src/robotaxi/pages/site-search/index.tsx
index ec71b0c..812594b 100644
--- a/src/robotaxi/pages/site-search/index.tsx
+++ b/src/robotaxi/pages/site-search/index.tsx
@@ -10,7 +10,7 @@
import { getOrderDistance } from '../../api/select-map-site';
import { AMAP_KEY, _UID } from '../../../constants/api';
import amapFile from '../../../libs/amap-wx.130.js';
-import { checkOtp, getStorage } from '../../../utils/tools';
+import { checkOtp } from '../../../utils/tools';
import TipPopup from '../select-map-site/components/tip-popup';
import { getNearestSite } from '../../api/home';
@@ -242,22 +242,6 @@
return;
}
} catch { }
- // 埋点
- getStorage(_UID).then((uid) => {
- const $app: any = Taro.getApp().$app;
- $app.xpReportSend({
- eventId: 'RT_mp_user_address_searched',
- para: {
- eventId: 'RT_mp_user_address_searched',
- user_id: uid || '-1',
- search_type: pageType === 'start' ? 'pickup ' : 'dropoff ',
- geo_lat: item.latitude,
- geo_lng: item.longitude,
- odd_grid_id: item.electronicAreaId,
- timestamp: Date.now(),
- },
- });
- });
Taro.setStorageSync('startSite', item);
Taro.navigateBack()
} else if (pageType == 'end') {
@@ -298,18 +282,6 @@
}
}
} catch { }
- // 埋点
- getStorage(_UID).then((uid) => {
- const $app: any = Taro.getApp().$app;
- $app.xpReportSend({
- eventId: 'RT_mp_user_address_searched',
- para: {
- eventId: 'RT_mp_user_address_searched',
- user_id: uid || '-1',
- search_type: pageType === 'start' ? 'pickup ' : 'dropoff ',
- },
- });
- });
Taro.setStorageSync('endSite', item)
Taro.reLaunch({
url: Taro.getStorageSync('orderId') ? '/robotaxi/pages/begin-route/index?skipPageFlag=1' : '/robotaxi/pages/begin-route/index',
diff --git a/src/utils/Robotaxi-public-method.ts b/src/utils/Robotaxi-public-method.ts
index 04be142..cca17fc 100644
--- a/src/utils/Robotaxi-public-method.ts
+++ b/src/utils/Robotaxi-public-method.ts
@@ -1,9 +1,11 @@
import amapFile from '../libs/amap-wx.130.js';
-import { AMAP_KEY, _ROBOTAXI_HOST } from '../constants/api';
+import { AMAP_KEY, _ROBOTAXI_HOST, _UID } from '../constants/api';
import Taro from '@tarojs/taro';
import request from './request';
import { getFenceCheck, getNearestSite } from '../robotaxi/api/home';
import { getOpenCity } from '../robotaxi/api/select-city';
+import { getStorage, getOrCreateLocalId } from './tools';
+
// 辅助函数:计算两点之间的距离(单位:米)
export const getDistance = (lat1: number, lng1: number, lat2: number, lng2: number) => {
@@ -613,3 +615,32 @@
return 0;
}
}
+
+// 埋点
+export const reportEvent = async (eventId: string, para: any) => {
+ let appVersion = '';
+ const $app: any = Taro.getApp().$app;
+ const { openId } = await $app.getIdData() || {};
+ try {
+ const accountInfo = Taro.getAccountInfoSync();
+ appVersion = accountInfo?.miniProgram?.version || accountInfo?.miniProgram?.envVersion || '';
+ } catch (e) {
+ console.warn('获取小程序版本号失败:', e);
+ }
+
+ getStorage(_UID).then((uid) => {
+ $app.xpReportSend({
+ eventId,
+ para: {
+ ...para,
+ user_id: uid || '-1',
+ masked_device_id: openId,
+ event_time: Date.now(),
+ city: Taro.getStorageSync('selectedCity').name,
+ orderId: Taro.getStorageSync('orderId') || '',
+ os: Taro.getSystemInfoSync().system,
+ app_ver: appVersion,
+ },
+ });
+ });
+}
--
Gitblit v1.7.1