li.shaoyi 5 ヶ月 前
コミット
be9608a15d

+ 7 - 7
src/hooks/meta-pixel/index.ts

@@ -55,13 +55,13 @@ export function useMetaPixel() {
 
     // 跟踪自定义事件
     const trackEvent = (eventName: 'Lead' | 'Purchase', parameters?: Record<string, any>) => {
-        // if (pixelId) {
-        //     window.fbq('track', eventName, parameters)
-        // }
-
-        plus.onPlusReady((plus) => {
-            plus.bridge.exec('FacebookExpand', 'expandFunction', [])
-        })
+        if (pixelId) {
+            if (plus.hasPlus()) {
+                window.plus.bridge.exec('FacebookExpand', 'metaPixelFunction', [eventName, JSON.stringify(parameters)])
+            } else {
+                window.fbq('track', eventName, parameters)
+            }
+        }
     }
 
     // 在组件挂载时初始化

+ 1 - 4
src/packages/mobile/views/user/register/Index.vue

@@ -82,7 +82,6 @@ import { reactive, shallowRef, ref, computed, onMounted, useAttrs } from 'vue'
 import { CellGroup, Cell, Button, Field, Form, FormInstance, Checkbox, showFailToast, showToast, FieldRule, Popup, Picker, PickerConfirmEventParams, showSuccessToast } from 'vant'
 import { useCountDown } from '@vant/use'
 import { fullloading, dialog } from '@/utils/vant'
-import { tmMatchAccountID } from '@/filters'
 import { validateRules } from '@/constants/regex'
 import { useMetaPixel } from '@/hooks/meta-pixel'
 import { useNavigation } from '@mobile/router/navigation'
@@ -245,9 +244,7 @@ const formRules: { [key: string]: FieldRule[] } = {
 // 路由跳转
 const routerAction = () => {
   // 追踪注册结果
-  trackEvent('Lead', {
-    content_name: tmMatchAccountID(formData.mobilephone)
-  })
+  trackEvent('Lead')
 
   if (attrs.onRouterAction) {
     emit('routerAction')

+ 0 - 11
src/packages/tss/views/home/main/index.vue

@@ -12,14 +12,6 @@
       </app-statusbar>
     </template>
     <div ref="containerRef" class="home-main__container" :style="{ backgroundImage: `url(${getFileUrl(topBanners)})` }">
-
-
-
-      <button type="button" style="border: 1px solid #000; padding: 20px; background-color: #fff;"
-        @click="trackEvent('Lead')">Facebook Test</button>
-
-
-
       <app-block class="home-main__notice">
         <h4 @click="$router.push({ name: 'notice-list' })">
           <span>{{ $t('routes.notice') }}</span>
@@ -63,15 +55,12 @@
 import { shallowRef, onMounted, onActivated, onDeactivated } from 'vue'
 import { Cell, CellGroup, Search, Icon } from 'vant'
 import { getFileUrl } from '@/filters'
-import { useMetaPixel } from '@/hooks/meta-pixel'
 import { queryImageConfigs } from '@/services/api/common'
 import { queryNewTitles } from '@/services/api/news'
 import { useNoticeStore, useGoodsCollectionStore } from '@/stores'
 import plus from '@/utils/h5plus'
 import ProductList from '../../product/list/components/waterfall-list/index.vue'
 
-const { trackEvent } = useMetaPixel()
-
 const noticeStore = useNoticeStore()
 const goodsCollectionStore = useGoodsCollectionStore()