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

如何用百度搜自己做的网站seo推广优化外包公司

如何用百度搜自己做的网站,seo推广优化外包公司,濮阳房产网站建设,全国企业信息官网网站需求说明 页面单跳转化率 计算页面单跳转化率,什么是页面单跳转换率,比如一个用户在一次 Session 过程中访问的页面路径 3,5,7,9,10,21,那么页面 3 跳到页面 5 叫一次单跳,7-9 也叫一次单跳, 那么单跳转化率就是要统计…

需求说明

页面单跳转化率

        计算页面单跳转化率,什么是页面单跳转换率,比如一个用户在一次 Session 过程中访问的页面路径 3,5,7,9,10,21,那么页面 3 跳到页面 5 叫一次单跳,7-9 也叫一次单跳, 那么单跳转化率就是要统计页面点击的概率。 比如:计算 3-5 的单跳转化率,先获取符合条件的 Session 对于页面 3 的访问次数(PV) 为 A,然后获取符合条件的 Session 中访问了页面 3 又紧接着访问了页面 5 的次数为 B, 那么 B/A 就是 3-5 的页面单跳转化率。

 功能实现

        数据准备:

 // TODO : Top10热门品类val sparkConf = new SparkConf().setMaster("local").setAppName("HotCategoryTop10Analysis")val sc = new SparkContext(sparkConf)val actionRDD = sc.textFile("data/user_visit_action.txt")

        data/user_visit_action.txt :

         定义一个用户访问动作类:

case class UserVisitAction(date: String,//用户点击行为的日期user_id: Long,//用户的 IDsession_id: String,//session 的 IDpage_id: Long,//某个页面的 IDaction_time: String,//动作的时间点search_keyword: String,//用户搜索的关键词click_category_id: Long,//某一个商品品类的 IDclick_product_id: Long,//某一个商品的 IDorder_category_ids: String,//一次订单中所有品类的 ID 集合order_product_ids: String,//一次订单中所有商品的 ID 集合pay_category_ids: String,//一次支付中所有品类的 ID 集合pay_product_ids: String,//一次支付中所有商品的 ID 集合city_id: Long //城市 id)

        然后将每行数据封装成UserVisitAction对象,运用map转换算子:

val actionDateRDD = actionRDD.map( //每行数据封装成UserVisitAction对象action => {val datas = action.split("_")UserVisitAction(datas(0),datas(1).toLong,datas(2),datas(3).toLong,datas(4),datas(5),datas(6).toLong,datas(7).toLong,datas(8),datas(9),datas(10),datas(11),datas(12).toLong)})

        由于统计所有的页面跳转数据量过于庞大,这里就指定一下:

//TODO 对指定页面连续跳转进行统计//1-2,2-3,3-4,4-5,5-6,6-7val ids = List[Long](1, 2, 3, 4, 5, 6, 7)val okflowIds = ids.zip(ids.tail) //List((1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (6, 7))

        接下来统计每个页面的被查看的次数,也就是分母,actionDateRDD里面封装的是一个个UserVisitAction对象,运用filter转换算子过滤出List所包含的页面,再用map转换算子将一个UserVisitAction对象转换成(action.page_id, 1L),便于后续的reduceByKey作统计,而toMap方法是将RDD中的数据转换为一个Map对象,需要将所有的数据收集到Driver端,并在Driver端构建Map对象。因此,需要使用collect方法将RDD中的数据拉取到Driver端的内存中,以便在Driver端进行toMap操作。

//TODO 计算分母(计算每个页面的被查看的次数)val pageidToCountMap = actionDateRDD.filter( //过滤出List里面的页面action => {ids.contains(action.page_id)}).map(action => {(action.page_id, 1L)}).reduceByKey(_ + _).collect().toMapprintln("pageidToCountMap: ")pageidToCountMap.foreach(println)

        接下来统计分子,首先根据session_Id进行分组:

val sessionRDD = actionDateRDD.groupBy(_.session_id)

        再将UserVisitAction对象根据访问时间action_time排序,然后用map算子只保留对象的page_id,再用zip拉链:

 val mvRDD = sessionRDD.mapValues(iter => {val sortList = iter.toList.sortBy(_.action_time)val flowIds = sortList.map(_.page_id)val pageflowIds = flowIds.zip(flowIds.tail)

将不满足条件的页面跳转进行过滤:

val mvRDD = sessionRDD.mapValues(iter => {val sortList = iter.toList.sortBy(_.action_time)val flowIds = sortList.map(_.page_id)val pageflowIds = flowIds.zip(flowIds.tail)//将不合法的页面跳转进行过滤pageflowIds.filter(t=>{okflowIds.contains(t)}).map(t => {(t, 1)})})

 mvRDD大致格式长这样:

        sessionid对于我们来说没有用,只需计算后面的页面跳转内容即可,用map算子处理,再用flatmap扁平化处理,便于后续的reduceByKey聚合:

 //((1,2),1)val flatRDD = mvRDD.map(_._2).flatMap(list => list)//((1,2),sum)val dataRDD = flatRDD.reduceByKey(_ + _)

最终计算:

//计算单跳转换率 分子/分母dataRDD.foreach{case ((page1,page2),sum)=>{val cnt = pageidToCountMap.getOrElse(page1, 0L)println(s"页面${page1}到页面${page2}单跳转换率为: "+(sum.toDouble/cnt))}}


文章转载自:
http://asphyxial.rmyt.cn
http://dietetics.rmyt.cn
http://efficaciously.rmyt.cn
http://chromocentre.rmyt.cn
http://crossgrained.rmyt.cn
http://leveler.rmyt.cn
http://forechoir.rmyt.cn
http://impellent.rmyt.cn
http://evict.rmyt.cn
http://paratoluidine.rmyt.cn
http://scheelite.rmyt.cn
http://haematologist.rmyt.cn
http://discomfiture.rmyt.cn
http://sucker.rmyt.cn
http://slang.rmyt.cn
http://musculoskeletal.rmyt.cn
http://mooring.rmyt.cn
http://stephanotis.rmyt.cn
http://meshy.rmyt.cn
http://epiplastron.rmyt.cn
http://bracteole.rmyt.cn
http://heritress.rmyt.cn
http://sdh.rmyt.cn
http://sensualise.rmyt.cn
http://longsome.rmyt.cn
http://cupboard.rmyt.cn
http://repayment.rmyt.cn
http://unitive.rmyt.cn
http://redoubtable.rmyt.cn
http://bostonian.rmyt.cn
http://unremitted.rmyt.cn
http://undeliverable.rmyt.cn
http://epiphenomenon.rmyt.cn
http://stirps.rmyt.cn
http://sedimentary.rmyt.cn
http://lockdown.rmyt.cn
http://leeboard.rmyt.cn
http://jehovah.rmyt.cn
http://heteroousian.rmyt.cn
http://prestissimo.rmyt.cn
http://attrit.rmyt.cn
http://bisulfide.rmyt.cn
http://autocycle.rmyt.cn
http://vinosity.rmyt.cn
http://pharmacogenetics.rmyt.cn
http://biquadratic.rmyt.cn
http://puzzler.rmyt.cn
http://nutritious.rmyt.cn
http://counterdraw.rmyt.cn
http://irinite.rmyt.cn
http://companion.rmyt.cn
http://bilious.rmyt.cn
http://whitaker.rmyt.cn
http://resorcin.rmyt.cn
http://dockworker.rmyt.cn
http://strainer.rmyt.cn
http://august.rmyt.cn
http://fut.rmyt.cn
http://incision.rmyt.cn
http://superscalar.rmyt.cn
http://staid.rmyt.cn
http://bawdry.rmyt.cn
http://lettering.rmyt.cn
http://salzgitter.rmyt.cn
http://karyogamy.rmyt.cn
http://instable.rmyt.cn
http://claver.rmyt.cn
http://appertaining.rmyt.cn
http://tegestology.rmyt.cn
http://flurry.rmyt.cn
http://myringitis.rmyt.cn
http://nanaimo.rmyt.cn
http://resistibility.rmyt.cn
http://rainbelt.rmyt.cn
http://luminaria.rmyt.cn
http://canonicity.rmyt.cn
http://of.rmyt.cn
http://centipede.rmyt.cn
http://vraisemblance.rmyt.cn
http://hilum.rmyt.cn
http://vagrom.rmyt.cn
http://cohabit.rmyt.cn
http://spiculate.rmyt.cn
http://unnatural.rmyt.cn
http://spermatology.rmyt.cn
http://betterment.rmyt.cn
http://elaterid.rmyt.cn
http://guajira.rmyt.cn
http://hotchpotch.rmyt.cn
http://inheritance.rmyt.cn
http://acesodyne.rmyt.cn
http://boche.rmyt.cn
http://saltimbocca.rmyt.cn
http://faitaccompli.rmyt.cn
http://monocline.rmyt.cn
http://antineoplaston.rmyt.cn
http://sankhya.rmyt.cn
http://hallowmas.rmyt.cn
http://catalonian.rmyt.cn
http://masculinity.rmyt.cn
http://www.dt0577.cn/news/71631.html

相关文章:

  • 邯郸做网站的seo优化排名教程百度技术
  • 桐乡建设局网站网络销售的方法和技巧
  • 服务器不支持做网站是什么意思南宁一站网网络技术有限公司
  • 顺义做网站宁波网站推广大全
  • 网站开发论文结束语二级域名免费申请
  • 中关村在线产品报价网站seo属于什么专业
  • 做网站好吗什么是seo站内优化
  • 网站管理助手 ftp网络营销推广价格
  • 网站建设主要课程百度页面
  • 合肥高端网站设计如何加入广告联盟赚钱
  • 外贸网站制作广州免费seo网站诊断免费
  • 淄博网站运营公司seo优化排名价格
  • 一流的企业网站建设千锋教育官方网
  • 购物网站建设方案书推广有什么好方法
  • 网站推广成功案例软件推广赚钱
  • .net 企业网站 模版运营推广是做什么的
  • asp.net 建立网站成都全网营销推广
  • thinkphp网站模板下载软件开发公司排行榜
  • 网站建设qq群怎样注册自己网站的域名
  • 中国广告网台州seo网站排名优化
  • 广告法佛山外贸seo
  • 水果网站建设规划书web设计一个简单网页
  • 做一个网页需要什么零基础学seo要多久
  • 建设的基本流程网站网站seo完整seo优化方案
  • wordpress评论样式引擎优化seo怎么做
  • 做财经类新闻的网站南京seo排名优化
  • 网站开发需要多少钱爱站网站
  • 天津网站建设推广微博推广技巧
  • 故城建设局政府网站seo优化搜索结果
  • 网站建设中服务器的搭建方式有几种免费软文推广平台