feat(analytics): 添加阿里云日志服务埋点上报功能

在多个页面添加aplus埋点上报逻辑,包括PV和自定义事件上报
在index.html中添加阿里云日志服务SDK初始化配置
This commit is contained in:
34701892@qq.com 2025-09-27 17:54:47 +08:00
parent 654b908f16
commit f4ceec3c7a
5 changed files with 91 additions and 28 deletions

View File

@ -32,6 +32,43 @@
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/main.ts"></script>
<script>
(function (w, d, s, q, i) {
w[q] = w[q] || [];
var f = d.getElementsByTagName(s)[0], j = d.createElement(s);
j.async = true;
j.id = 'beacon-aplus';
j.src = 'https://d.alicdn.com/alilog/mlog/aplus/' + i + '.js';
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'aplus_queue', '203467608');
//集成应用的appKey
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: ['appKey', '68d7b06e8560e34872b9f3a7']
});
/************************以下内容为可选配置内容****************************/
//sdk提供手动pv发送机制启用手动pv(即关闭自动pv)需设置aplus-waiting=MAN;
//注意由于单页面路由改变时不会刷新页面无法自动发送pv所以对于单页应用强烈建议您关闭自动PV, 手动控制PV事件
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: ['aplus-waiting', 'MAN']
});
//是否开启调试模式
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: ['DEBUG', true]
});
//是否指定用作计算umid的id类型默认为cnaid目前支持:
//1. 微信和QQ: openid; 字节和百度 anonymousid; 支付宝 alipay_id
//2. 微信、QQ、字节、百度平台的 unionid
//3. 业务方自己生成的随机id uuid
// aplus_queue.push({
// action: 'aplus.setMetaInfo',
// arguments: ['aplus-idtype', 'xxxx'] //取值参考见附表1
// });
</script>
<!-- <script type="text/javascript">
var link = location.href.split("#")[0];
console.log("🚀 ~ link:", link);

View File

@ -32,7 +32,7 @@
</template>
<script setup lang="ts">
import { ref } from "vue";
import { onMounted, ref } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { onReachBottom } from "@dcloudio/uni-app";
import {
@ -175,6 +175,24 @@ const jumpAll = () => {
}
};
const { aplus_queue } = window;
onMounted(() => {
aplus_queue.push({
action: 'aplus.sendPV',
arguments: [{ is_auto: false }] //
});
//demo
aplus_queue.push({
action: 'aplus.record',
arguments: ['goDetail', 'CLK', {
param1: data.value.id,
param2: data.value.title,
}]
});
})
//
const jumpDetail = (item: any) => {
// console.log(item)

View File

@ -300,6 +300,12 @@ onMounted(async () => {
//
getNewsList();
const { aplus_queue } = window;
aplus_queue.push({
action: 'aplus.sendPV',
arguments: [{ is_auto: false }] //
});
});
/**

View File

@ -98,11 +98,8 @@
<view class="logout" @click="loginOut" v-if="Session.get('token')">退出登录</view>
<LoginPopup
:show="LoginShow"
@handlePopupClose="handlePopupClose"
@handlePopupSuccessCallback="handlePopupSuccessCallback"
@handlePopupErrorCallback="handlePopupErrorCallback" />
<LoginPopup :show="LoginShow" @handlePopupClose="handlePopupClose"
@handlePopupSuccessCallback="handlePopupSuccessCallback" @handlePopupErrorCallback="handlePopupErrorCallback" />
</view>
</template>
@ -303,13 +300,19 @@ function goSreach() {
onUnmounted(() => {
clearInterval(timer);
});
const { aplus_queue } = window;
onMounted(async () => {
initData();
if (!Session.get("token")) {
LoginShow.value = true;
}
getLineDataFn();
aplus_queue.push({
action: 'aplus.sendPV',
arguments: [{ is_auto: false }] //
});
});
</script>

View File

@ -1,19 +1,12 @@
<template>
<view class="all">
<PageHeaderView
:title="type == 0 ? '热门行业池Top10' : '风口概念池Top10'"
></PageHeaderView>
<PageHeaderView :title="type == 0 ? '热门行业池Top10' : '风口概念池Top10'"></PageHeaderView>
<!-- 类目标签 start -->
<view class="page_content">
<view class="tag_list">
<view
:class="['tag_item', clickTagIndex == index ? tagClickedClass : '']"
class="tag_item"
v-for="(item, index) in tagList"
:key="index"
@click="clickTag(index)"
>
<view :class="['tag_item', clickTagIndex == index ? tagClickedClass : '']" class="tag_item"
v-for="(item, index) in tagList" :key="index" @click="clickTag(index)">
{{ item.content }}
</view>
</view>
@ -22,12 +15,7 @@
<!-- 列表 start -->
<view class="list">
<view
v-for="(item, index) in list"
:key="index"
class="news-item"
@click="goDetail(item)"
>
<view v-for="(item, index) in list" :key="index" class="news-item" @click="goDetail(item)">
<view class="news-content">
<text class="news-title">{{ item.title }}</text>
<text class="news-desc">{{ item.summary }}</text>
@ -165,6 +153,12 @@ onMounted(async () => {
}
getListByTagFn();
const { aplus_queue } = window;
aplus_queue.push({
action: 'aplus.sendPV',
arguments: [{ is_auto: false }] //
});
});
</script>
@ -254,11 +248,16 @@ onMounted(async () => {
text-align: left;
font-style: normal;
display: -webkit-box; /* 设置为WebKit内核的弹性盒子模型 */
-webkit-box-orient: vertical; /* 垂直排列 */
-webkit-line-clamp: 2; /* 限制显示三行 */
overflow: hidden; /* 隐藏超出范围的内容 */
text-overflow: ellipsis; /* 使用省略号 */
display: -webkit-box;
/* 设置为WebKit内核的弹性盒子模型 */
-webkit-box-orient: vertical;
/* 垂直排列 */
-webkit-line-clamp: 2;
/* 限制显示三行 */
overflow: hidden;
/* 隐藏超出范围的内容 */
text-overflow: ellipsis;
/* 使用省略号 */
}
.news-meta {