Эх сурвалжийг харах

feat: 完善广告位曝光上报

zhangyuhan 4 сар өмнө
parent
commit
ebc836fe86

+ 10 - 1
apps/bigmember_pc/src/views/workspace/components/AdContainer.vue

@@ -1,6 +1,11 @@
 <template>
   <div class="ad-container" v-show="carouselList.length">
-    <AdSwipe :list="carouselList" :height="height" :code="code" />
+    <AdSwipe
+      :exposure-prefix="exposurePrefix"
+      :list="carouselList"
+      :height="height"
+      :code="code"
+    />
   </div>
 </template>
 
@@ -14,6 +19,10 @@ export default {
     AdSwipe
   },
   props: {
+    exposurePrefix: {
+      type: String,
+      default: ''
+    },
     code: {
       type: String,
       default: ''

+ 15 - 3
apps/bigmember_pc/src/views/workspace/components/AsideOthers.vue

@@ -1,8 +1,20 @@
 <template>
   <div class="aside-others-container">
-    <AdContainer class="aside-item" :list="listMap[codes[0]]" />
-    <AdContainer class="aside-item production-card" :list="listMap[codes[1]]" />
-    <AdContainer class="aside-item production-card" :list="listMap[codes[2]]" />
+    <AdContainer
+      exposure-prefix="PC工作桌面首页-"
+      class="aside-item"
+      :list="listMap[codes[0]]"
+    />
+    <AdContainer
+      exposure-prefix="PC工作桌面首页-"
+      class="aside-item production-card"
+      :list="listMap[codes[1]]"
+    />
+    <AdContainer
+      exposure-prefix="PC工作桌面首页-"
+      class="aside-item production-card"
+      :list="listMap[codes[2]]"
+    />
   </div>
 </template>
 

+ 6 - 0
apps/bigmember_pc/src/views/workspace/ui/AdSwipe.vue

@@ -14,6 +14,8 @@
         target="_blank"
         @click="openNewTab(item)"
         :id="[code, index].join('-')"
+        :data-exposure="exposurePrefix + item.name"
+        data-exposure-loop
       >
         <img :src="item.pic" :alt="item.name" />
       </a>
@@ -30,6 +32,10 @@ export default {
     [CarouselItem.name]: CarouselItem
   },
   props: {
+    exposurePrefix: {
+      type: String,
+      default: ''
+    },
     code: {
       type: String,
       required: true,

+ 35 - 44
apps/mobile/src/views/tabbar/Home.vue

@@ -13,7 +13,7 @@
         <img
           src="@/assets/image/public/logo-text-transparent-bg@2x.png"
           alt=""
-        >
+        />
       </div>
     </h5>
     <!-- 搜索框 -->
@@ -92,6 +92,7 @@
     <!-- 弹窗广告位 -->
     <AdPopScreen
       v-if="AD.full.pic"
+      data-exposure="首页-弹窗广告位"
       v-show="newUserPopConfig.showNextFullPop"
       cache-key="pop-screen"
       :config="AD.full"
@@ -103,12 +104,18 @@
     <!-- 新注册用户活动广告位 -->
     <AdPopScreen
       v-if="isLogin && AD.newUserPop.pic"
+      data-exposure="首页-新注册用户活动广告位"
       :config="AD.newUserPop"
       :before-open="beforeOpenNewUserAD"
       @close="closeNewUserPop"
       @load="toggleMessagePopShow(false)"
     />
-    <CheckUserDialog v-if="dialog.checkUserShow" @initNext="onInitNextDialog3" />
+
+    <CheckUserDialog
+      data-exposure="首页-续费弹窗"
+      v-if="dialog.checkUserShow"
+      @initNext="onInitNextDialog3"
+    />
     <!-- 新注册用户底部悬浮广告位 -->
     <!-- <div class="new-user--pop-bottom" :class="{ 'has-wx': $envs.inWX }" v-if="isLogin && newUserPopConfig.showBottomPop && AD.newUserPopOfBottom.pic">
       <ad-single class="subscribe-top-box" :config="AD.newUserPopOfBottom"  :before-open="beforeOpenNewUserAD"  :show-tag="false" @close="closeNewUserPopOfBottom" @load="toggleMessagePopShow(false)"></ad-single>
@@ -116,6 +123,7 @@
 
     <!-- 微信小程序底部悬浮,未关注引导广告位 -->
     <div
+      data-exposure="首页-微信小程序底部悬浮,未关注引导广告位"
       v-if="showMiniProgramAppBottomAd"
       class="miniprogram--pop-bottom has-wx"
     >
@@ -261,17 +269,16 @@ export default {
       const { inAppOrH5 } = this.$envs
       if (this.isLogin) {
         return inAppOrH5
-      }
-      else {
+      } else {
         return false
       }
     },
     showMiniProgramAppBottomAd() {
       const envPass = this.$envs.inWxMini
       return (
-        envPass
-        && this.AD.checkSubscribeConfig.pic
-        && this.dialog.followFollowGuide
+        envPass &&
+        this.AD.checkSubscribeConfig.pic &&
+        this.dialog.followFollowGuide
       )
     },
     getHeaderAD() {
@@ -348,8 +355,7 @@ export default {
       const cache = this.$storage.get(key, false)
       if (cache) {
         // do something
-      }
-      else {
+      } else {
         this.showAIGuidePopover = true
         this.$storage.set(key, '1')
       }
@@ -359,19 +365,17 @@ export default {
       if (code === 0) {
         const thisTime = Math.round(new Date() / 1000)
         if (
-          thisTime >= data?.bulletFrameStart
-          && thisTime <= data?.bulletFrameEnd
+          thisTime >= data?.bulletFrameStart &&
+          thisTime <= data?.bulletFrameEnd
         ) {
           this.showTutorial = true
-        }
-        else {
+        } else {
           this.showTutorial = false
         }
       }
     },
     async checkSubscribe() {
-      if (!this.$envs.inWxMini)
-        return
+      if (!this.$envs.inWxMini) return
       const { error_code: code, data } = await getSubscribeStatus()
       if (code === 0 && data) {
         const r = {
@@ -462,11 +466,9 @@ export default {
       }
     },
     checkCacheToSearch() {
-      if (!this.isLogin)
-        return false
+      if (!this.isLogin) return false
       const { toSearch } = this.cacheState
-      if (!toSearch)
-        return false
+      if (!toSearch) return false
       this.cacheState.toSearch = false
       this.toSearchFocus()
     },
@@ -528,8 +530,7 @@ export default {
           storage.data.newUserPopConfig.showBottomPop = false
           storage.data.AD.newUserPop = {}
           storage.data.AD.newUserPopOfBottom = {}
-        }
-        catch (e) {}
+        } catch (e) {}
         Object.assign(this._data, storage.data)
         this.$storage.rm(this._CACHE_KEY, {
           login: true
@@ -538,8 +539,7 @@ export default {
           this.$forceUpdate()
           this.$refs['home-page'].scrollTop = storage.top
         })
-      }
-      else {
+      } else {
         // 限制刷新频率
         const nowTime = new Date().getTime()
         const maxUpdateTime = 5 * 1000
@@ -617,8 +617,7 @@ export default {
      * @param codes
      */
     getAD() {
-      if (!this.isLogin)
-        return
+      if (!this.isLogin) return
       // 获取消息悬浮信息
       this.toggleMessagePopShow(true)
       // 获取新用户弹窗广告信息
@@ -629,7 +628,7 @@ export default {
         // this.getPlatformAD.header,
         this.getPlatformAD.swipe,
         this.getPlatformAD.floor
-      ].filter(v => v)
+      ].filter((v) => v)
       ajaxGetAD({
         codes
       })
@@ -648,21 +647,18 @@ export default {
 
             if (header.length) {
               this.AD.header = header.map(adConfigFormatter)[0]
-            }
-            else {
+            } else {
               this.AD.header = {}
             }
             if (full?.length) {
               this.AD.full = full.map(adConfigFormatter)[0]
-            }
-            else {
+            } else {
               this.onInitNextDialog()
               this.AD.full = {}
             }
             if (side.length) {
               this.AD.side = side.map(adConfigFormatter)[0]
-            }
-            else {
+            } else {
               this.AD.side = {}
             }
           }
@@ -684,8 +680,7 @@ export default {
             this.toggleMessagePopShow(false)
             this.AD.newUserPop = res.data.map(adConfigFormatter)[0]
             this.AD.newUserPopOfBottom = res.data.map(adConfigFormatter)[1]
-          }
-          else {
+          } else {
             this.clearNewUserPopCache()
           }
         })
@@ -718,12 +713,10 @@ export default {
           wx.miniProgram.navigateTo({
             url: '/pages/guide/index' // 指定要跳转到的页面路径及参数
           })
-        }
-        catch (error) {
+        } catch (error) {
           console.log(error)
         }
-      }
-      else {
+      } else {
         this.$router.push({
           path: '/static/follow_guide'
         })
@@ -740,8 +733,7 @@ export default {
       if (isClose) {
         this.newUserPopConfig.showNextFullPop = true
         this.newUserPopConfig.showBottomPop = true
-      }
-      else {
+      } else {
         this.clearNewUserPopCache()
       }
     },
@@ -769,8 +761,8 @@ export default {
       if (type) {
         // 判断是否展示有其他广告位
         if (
-          this.newUserPopConfig.showNextFullPop
-          || this.newUserPopConfig.showBottomPop
+          this.newUserPopConfig.showNextFullPop ||
+          this.newUserPopConfig.showBottomPop
         ) {
           return
         }
@@ -793,8 +785,7 @@ export default {
     getNowMessagePopInfo() {
       try {
         window.getMsgBuoyActive.getBuoyMsgAjax()
-      }
-      catch (e) {
+      } catch (e) {
         console.warn(e)
       }
     },