当前位置: 首页 > news >正文

怎么到百度做网站网络营销专业如何

怎么到百度做网站,网络营销专业如何,建e网下载,塘沽建设网站一、统计app激活状态 在App.vue 中 利用onShow生命周期验证 或者操作 onShow: function () { uni.showToast({ title: onShow }) }, 二、页面级别的统计 (进入页面、停留时长、手机系统信息、网络状态、页面路径、标题) 需要收集的数据 { &quo…

一、统计app激活状态

在App.vue 中 利用onShow生命周期验证 或者操作

onShow: function () {

uni.showToast({

title: 'onShow'

})

},

二、页面级别的统计 (进入页面、停留时长、手机系统信息、网络状态、页面路径、标题)

需要收集的数据

{

"pageType": "leavePage",

"networkType": "wifi",

"pageInfo": {

"pageUrl": "pages/index/newIndex",

"title": ""

},

"entryTime": "2024-04-10 13:18:50",

"leaveTime": "2024-04-10 13:18:51",

"nowTime": "2024-04-10 13:18:51",

"stayTime": 279,

"sysTemInfo": {

"appName": "某某app",

"appVersion": "2.1.4",

"brand": "apple",

"platform": "ios",

"system": "iOS 17.3.1"

},

"pageLoadTime": 873

}

通过混入mixins 每个页面生命周期埋点统计、编写逻辑方法

三、页面内部事件级别的统计 (各种事件信息集合eventTrack(点击、复制、下载、来源某个特定页面的操作)、 手机系统信息、网络状态、页面路径、标题)

需要收集的数据

{

"networkType": "unknown",

"pageInfo": {

"pageUrl": "pages/order/index",

"title": "订单"

},

"sysTemInfo": {

"appName": "某某app",

"appVersion": "2.1.4",

"brand": "xiaomi",

"platform": "android",

"system": "Android 12"

},

"eventTrack": { // 事件所需要的埋点字段

"eventCode": "B0004"

}

}

通过混入mixins 每个页面生命周期埋点统计、编写逻辑方法

四、具体的设计流程

1、创建 埋点sdk方法 pointCom.js

主要三个方法

myPointPage, 页面级别触发的

toDateDetail, 时间转化函数

myPointEvent, 页面内部事件触发的

详细编码

import { pagesObj } from '@/uni-config/pages.js' // 页面路由和标题的映射map

console.log(pagesObj, 'uni-config')

async function myPointPage(pageType = "", pageUrl = "") {

console.log("埋点", pageType, pageUrl);

let entryTime, leaveTime, stayTime, nowTime;

if (!pageType) return;

if (pageType == "entryPage") {

entryTime = new Date().getTime();

nowTime = new Date().getTime();

leaveTime = null;

uni.setStorageSync("entryTime", entryTime);

} else {

entryTime = uni.getStorageSync("entryTime");

leaveTime = new Date().getTime();

stayTime = leaveTime - entryTime;

nowTime = new Date().getTime();

}

uni.getNetworkType({

success: function (res) {

let networkType = res.networkType;

try {

uni.getSystemInfo({

success: function (res) {

let { appName,

appWgtVersion,

brand,

platform,

system } = res

let data = {

pageType: pageType,

networkType: networkType,

pageInfo: {

pageUrl: pageUrl,

title: pagesObj[pageUrl]

},

entryTime: toDateDetail(entryTime),

leaveTime: toDateDetail(leaveTime),

nowTime: toDateDetail(nowTime),

stayTime: stayTime,

sysTemInfo: {

appName,

appVersion: appWgtVersion,

brand,

platform,

system

},

};

if (pageType === "leavePage") {

data.pageLoadTime = uni.getStorageSync("pageLoadTime");

}

console.log('发送调用埋点接口', data)

},

fail(error) {

sysTemInfo = "null";

},

});

} catch (e) { }

},

});

}

async function myPointEvent(eventTrack = {}, pageUrl = "") {

uni.getNetworkType({

success: function (res) {

let networkType = res.networkType;

try {

uni.getSystemInfo({

success: function (res) {

let { appName,

appWgtVersion,

brand,

platform,

system } = res

let data = {

networkType: networkType,

pageInfo: {

pageUrl: pageUrl,

title: pagesObj[pageUrl]

},

sysTemInfo: {

appName,

appVersion: appWgtVersion,

brand,

platform,

system

},

eventTrack

};

console.log('myPointEvent发送调用埋点接口', data)

},

fail(error) {

sysTemInfo = "null";

},

});

} catch (e) { }

},

});

}

function toDateDetail(number) {

if (!number) return undefined;

// var n = number * 1000

var date = new Date(number);

var Y = date.getFullYear() + "-";

var M =

(date.getMonth() + 1 < 10

? "0" + (date.getMonth() + 1)

: date.getMonth() + 1) + "-";

var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();

var h = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();

var mm = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();

var s = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();

return Y + "" + M + "" + D + " " + h + ":" + mm + ":" + s;

}

export default {

myPointPage,

toDateDetail,

myPointEvent,

};

2、创建 埋点混入的方法和生命周期 pointMixin.js

主要四个方法

eventTrack, 页面事件调用的函数

entryTrack, 页面进入调用的函数

leaveTrack, 页面离开调用的函数

pageLoadTime 页面onReady调用的函数

详细编码

import pointCom from "@/utils/pointCom.js";

export default {

data() {

return {

pointPageUrl: "", //跳转url

pageType: "", //事件类型 进入、离开

loadStartTime: "", //页面加载开始时间

};

},

onLoad() {

this.entryTrack();

},

onReady() {

this.pageLoadTime();

},

onHide() {

this.leaveTrack();

},

onUnload() {

this.leaveTrack();

},

methods: {

eventTrack(eventTrack = {}) {

console.log('eventTrack', eventTrack, this.pointPageUrl)

let pointPageUrl = getCurrentPages()[getCurrentPages().length - 1].route;

this.pointPageUrl = pointPageUrl;

pointCom.myPointEvent(eventTrack, this.pointPageUrl);

},

entryTrack() {

let loadStartTime = pointCom.toDateDetail(Number(new Date()));

let pointPageUrl = getCurrentPages()[getCurrentPages().length - 1].route;

this.pointPageUrl = pointPageUrl;

this.pageType = "entryPage";

this.loadStartTime = loadStartTime;

pointCom.myPointPage("entryPage", this.pointPageUrl);

},

pageLoadTime() {

let pageLoadTime = Number(new Date()) - new Date(this.loadStartTime).getTime()

console.log("pageLoadTime", pageLoadTime, this.loadStartTime)

uni.setStorageSync("pageLoadTime", pageLoadTime);

},

leaveTrack() {

if (this.pageType === "leavePage") return;

this.pageType = "leavePage";

pointCom.myPointPage("leavePage", this.pointPageUrl);

},

},

};

3、main.js 引入 pointMixin.js

详细编码

import pointMixin from "@/utils/pointMixin"; //配合埋点的mixin

Vue.mixin(pointMixin);

4、得到页面路由和标题的映射map

h5中可以得到标题等数据,但是app中无法获取

// 获取当前页面链接和参数

function getCurrentPageUrlWithArgs() {

const pages = getCurrentPages();

const currentPage = pages[pages.length - 1];

const route = currentPage?.route;

const options = currentPage?.options || {};

const title = currentPage?.$holder?.navigationBarTitleText || ''

console.log(title)

let urlWithArgs = /${route}?;

for (let key in options) {

const value = options[key];

urlWithArgs += ${key}=${value}&;

}

urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1);

return {

options, //当前页面的参数

urlWithArgs, //当前页面的参数

route,

title,

};

}

app获取相关数据需要另辟蹊径

通过文件的读取和写入来实现
具体编码

const fs = require("fs-extra")

let path = require("path")

let Hjson = require("hjson")

const chokidar = require("chokidar")

let rootPath = (function () {

let e = path.resolve(__dirname, "./")

return e

})()

function creatPagesJs() {

try {

const fileContent = fs.readFileSync('./pages.json', 'utf8');

const jsonObj = Hjson.rt.parse(fileContent);

let pages = jsonObj.pages

let pagesObj = {}

pages.map(item => {

let path = item.path

let title = item?.style?.navigationBarTitleText || ''

pagesObj[path] = title

})

console.log(pagesObj, 'pagesObj')

let pstr = "export const pagesObj = " + JSON.stringify(pagesObj, null, 2);

fs.outputFileSync(

path.resolve(rootPath, "uni-config", "pages.js"),

pstr

);

} catch (err) {

console.log(err);

}

}

const watcherPagesJson = chokidar

.watch(path.resolve(__dirname, "./pages.json"))

watcherPagesJson.on("all", (event, path) => {

console.log(event, path, 'pages.json')

if (event == "change") {

creatPagesJs()

}

})

creatPagesJs();

如何调用 package.json 配置调用命令

"scripts": {

"getPages": "node getPages.js"

},


文章转载自:
http://anagrammatism.pqbz.cn
http://multilocular.pqbz.cn
http://leonore.pqbz.cn
http://scollop.pqbz.cn
http://mineralogy.pqbz.cn
http://meseems.pqbz.cn
http://subsistence.pqbz.cn
http://weewee.pqbz.cn
http://vegete.pqbz.cn
http://sudd.pqbz.cn
http://bmj.pqbz.cn
http://botanize.pqbz.cn
http://derelict.pqbz.cn
http://coercing.pqbz.cn
http://zoophagous.pqbz.cn
http://jugoslavia.pqbz.cn
http://psephology.pqbz.cn
http://enrol.pqbz.cn
http://strisciando.pqbz.cn
http://clearstarch.pqbz.cn
http://oxidize.pqbz.cn
http://belitong.pqbz.cn
http://stuffiness.pqbz.cn
http://douma.pqbz.cn
http://malathion.pqbz.cn
http://premium.pqbz.cn
http://overwater.pqbz.cn
http://tenderometer.pqbz.cn
http://ccis.pqbz.cn
http://transworld.pqbz.cn
http://chamberlain.pqbz.cn
http://pussycat.pqbz.cn
http://shinguard.pqbz.cn
http://dingbat.pqbz.cn
http://impressive.pqbz.cn
http://rhapsodic.pqbz.cn
http://genuflection.pqbz.cn
http://oarless.pqbz.cn
http://eigenvalue.pqbz.cn
http://denationalize.pqbz.cn
http://northwestwardly.pqbz.cn
http://minority.pqbz.cn
http://encyst.pqbz.cn
http://thirtieth.pqbz.cn
http://sequal.pqbz.cn
http://kokanee.pqbz.cn
http://holmium.pqbz.cn
http://lack.pqbz.cn
http://brisling.pqbz.cn
http://rba.pqbz.cn
http://cup.pqbz.cn
http://anear.pqbz.cn
http://sorrily.pqbz.cn
http://absolvent.pqbz.cn
http://camisade.pqbz.cn
http://hatha.pqbz.cn
http://dundee.pqbz.cn
http://anemochory.pqbz.cn
http://candie.pqbz.cn
http://equalise.pqbz.cn
http://carrel.pqbz.cn
http://gruel.pqbz.cn
http://subtersurface.pqbz.cn
http://defoamer.pqbz.cn
http://rachet.pqbz.cn
http://clarion.pqbz.cn
http://stuff.pqbz.cn
http://moneychanging.pqbz.cn
http://phenylethylamine.pqbz.cn
http://neuralgiform.pqbz.cn
http://bowdlerize.pqbz.cn
http://static.pqbz.cn
http://decruit.pqbz.cn
http://bathrobe.pqbz.cn
http://kinsoku.pqbz.cn
http://slater.pqbz.cn
http://curvous.pqbz.cn
http://postage.pqbz.cn
http://protestant.pqbz.cn
http://fling.pqbz.cn
http://spatted.pqbz.cn
http://prickly.pqbz.cn
http://incivilization.pqbz.cn
http://quadrennium.pqbz.cn
http://minute.pqbz.cn
http://selectron.pqbz.cn
http://procurance.pqbz.cn
http://myope.pqbz.cn
http://immoralize.pqbz.cn
http://nice.pqbz.cn
http://featherlight.pqbz.cn
http://furfuraceous.pqbz.cn
http://subedit.pqbz.cn
http://mileage.pqbz.cn
http://radioconductor.pqbz.cn
http://sleeveless.pqbz.cn
http://animatedly.pqbz.cn
http://helsingfors.pqbz.cn
http://savourily.pqbz.cn
http://retractility.pqbz.cn
http://www.dt0577.cn/news/96042.html

相关文章:

  • 万网主机网站建设数据库怎么弄qq群引流推广软件
  • 宁波网站设计开发网站排名怎么做上去
  • asp网站qq登录识图
  • 上海企业网站建设靠谱首页
  • 日本做美食视频网站北京做网站公司哪家好
  • 永久免费的网站长尾词在线挖掘
  • 广告创意设计图片赏析seo文案范例
  • 网站做响应式还是移动端seo优化的价格
  • 正安网站建设怎么把产品推广到各大平台
  • 建设农场网站一键优化免费下载
  • 临沂集团网站建设爱站网关键词查询网站
  • 激情做a图片视频网站公众号推广合作平台
  • 在什么网站做推广最好网络营销运营
  • 免费获取ppt模板的网站外贸网络营销平台
  • 怎么用优盘做网站登录密钥西安网站建设公司十强
  • 网站模块添加网站联盟
  • 初中上哪个网站找题做流量平台排名
  • 做旅游网站的产品经理如何软件排名优化
  • 学做ps的软件的网站免费快速网站
  • 做购物网站的引言百度快照推广是什么意思
  • 美女做暖暖视频的网站百度推广优化师培训
  • wordpress网络科技公司模板深圳百度快速排名优化
  • 政府网站建设指南培训网站官网
  • 企业做定制网站的好处网站页面设计
  • 深圳网站建设好2022磁力链接搜索引擎推荐
  • 做网站优化时代码结构关系大吗一起来看在线观看免费
  • 网站系统 外贸哪个浏览器看黄页最快夸克浏览器
  • 南京房产网深圳短视频seo教程
  • 企业做网站的注意事项百度seo工作室
  • 微信 公司网站 怎么做视频外链平台