发布网友 发布时间:2022-04-24 14:17
共5个回答
懂视网 时间:2022-04-15 06:32
需求:需要做一个统计 网站是这样的:网站上有 视频频道、图片频道、新闻频道等 需要做一个统计,能够统计这几个频道 中每个资源 某个小时、 某天、某周、某月、某年、总的 访问的次数 从上述需求看,只要统计每个资源,一天24 个小时的访问量 然后分类汇总就
需求:需要做一个统计-- ============================================= -- Author: -- Create date:-- Description: -- ============================================= CREATE proc [dbo].[procCountPV]( @ChannelID nvarchar(50), @SourceID int ) as begin declare @TEMID int; --临时ID declare @Now datetime; set @Now = GETDATE(); declare @Y smallint;--年 declare @M tinyint;--月 declare @W tinyint;--周 declare @D tinyint;--日 declare @H tinyint;--小时 set @Y = DATEPART(YY,@Now); set @M = DATEPART(MM,@Now); set @W = DATEPART(WW,@Now); set @D = DATEPART(DD,@Now); set @H = DATEPART(HH,@Now); select @TEMID = [ID] from [PV] where [ChannelID] = @ChannelID and [SourceID]=@SourceID and [Y] = @Y and [M]=@M and [D]=@D and [H] = @H; if @TEMID is null Insert into [PV]([ChannelID],[SourceID],[Times],[Y],[M],[W],[D],[H]) values(@ChannelID ,@SourceID,1,@Y,@M,@W,@D,@H); else Update [PV] set [Times] = [Times]+1 where [ID]= @TEMID; /*计算现在*/ Declare @NowHourTimes int; Declare @NowDayTimes int; Declare @NowWeekTimes int; Declare @NowMonthTimes int; Declare @NowYearTimes int; --Y M D H select @NowHourTimes = SUM([Times]) from [PV] where ChannelID = @ChannelID and SourceID = @SourceID and [Y] = @Y and [M]=@M and [D]=@D and [H] = @H; --Y M D select @NowDayTimes = SUM([Times]) from [PV] where ChannelID = @ChannelID and SourceID = @SourceID and [Y] = @Y and [M]=@M and [D]=@D; --Y W select @NowWeekTimes = SUM([Times]) from [PV] where ChannelID = @ChannelID and SourceID = @SourceID and [Y] = @Y and [W]=@W; --Y M select @NowMonthTimes = SUM([Times]) from [PV] where ChannelID = @ChannelID and SourceID = @SourceID and [Y] = @Y and [M]=@M; --Y select @NowYearTimes = SUM([Times]) from [PV] where ChannelID = @ChannelID and SourceID = @SourceID and [Y] = @Y; if @NowHourTimes is null set @NowHourTimes = 0; if @NowDayTimes is null set @NowDayTimes = 0; if @NowWeekTimes is null set @NowWeekTimes = 0; if @NowMonthTimes is null set @NowMonthTimes = 0; if @NowYearTimes is null set @NowYearTimes = 0; /*计算之前*/ Declare @PreHourTimes int; Declare @PreDayTimes int; Declare @PreWeekTimes int; Declare @PreMonthTimes int; Declare @PreYearTimes int; --Y M D H Declare @PreHourDateTime datetime; set @PreHourDateTime = DATEADD(HH,-1,@Now); select @PreHourTimes = SUM([Times]) from [PV] where ChannelID = @ChannelID and SourceID = @SourceID and [Y] = DATEPART(YY,@PreHourDateTime) and [M]=DATEPART(MM,@PreHourDateTime) and [D]=DATEPART(DD,@PreHourDateTime) and [H] = DATEPART(HH,@PreHourDateTime); --Y M D Declare @PreDayDateTime datetime; set @PreDayDateTime = DATEADD(DD,-1,@Now); select @PreDayTimes = SUM([Times]) from [PV] where ChannelID = @ChannelID and SourceID = @SourceID and [Y] = DATEPART(YY,@PreDayDateTime) and [M]=DATEPART(MM,@PreDayDateTime) and [D]=DATEPART(DD,@PreDayDateTime); --Y W Declare @PreWeekDateTime datetime; set @PreWeekDateTime = DATEADD(WW,-1,@Now); select @PreWeekTimes = SUM([Times]) from [PV] where ChannelID = @ChannelID and SourceID = @SourceID and [Y] = DATEPART(YY,@PreWeekDateTime) and [W]= DATEPART(WW,@PreWeekDateTime); --Y M Declare @PreMonthDateTime datetime; set @PreMonthDateTime = DATEADD(MM,-1,@Now); select @PreMonthTimes = SUM([Times]) from [PV] where ChannelID = @ChannelID and SourceID = @SourceID and [Y] = DATEPART(YY,@PreMonthDateTime) and [M]= DATEPART(MM,@PreMonthDateTime); --Y select @PreYearTimes = SUM([Times]) from [PV] where ChannelID = @ChannelID and SourceID = @SourceID and [Y] = @Y - 1; if @PreHourTimes is null set @PreHourTimes = 0; if @PreDayTimes is null set @PreDayTimes = 0; if @PreWeekTimes is null set @PreWeekTimes = 0; if @PreMonthTimes is null set @PreMonthTimes = 0; if @PreYearTimes is null set @PreYearTimes = 0; declare @HourRate float; declare @DayRate float; declare @WeekRate float; declare @MonthRate float; declare @YearRate float; set @HourRate = 0; set @DayRate = 0; set @WeekRate = 0; set @MonthRate = 0; set @YearRate = 0; if @PreHourTimes > 0 set @HourRate = ( @NowHourTimes - @PreHourTimes )/ (@PreHourTimes+0.0); if @PreDayTimes > 0 set @DayRate = ( @NowDayTimes - @PreDayTimes )/ (@PreDayTimes+0.0); if @PreWeekTimes > 0 set @WeekRate = ( @NowWeekTimes - @PreWeekTimes )/ (@PreWeekTimes+0.0); if @PreMonthTimes > 0 set @MonthRate = ( @NowMonthTimes - @PreMonthTimes )/ (@PreMonthTimes+0.0); if @PreYearTimes > 0 set @YearRate = ( @NowYearTimes - @PreYearTimes )/ (@PreYearTimes+0.0); /*计算总量*/ declare @Total int; select @Total = SUM([Times]) From [PV] where ChannelID = @ChannelID and SourceID = @SourceID; if @Total is null set @Total = 0; declare @TempID int; set @TempID = null; /*操作CountSummary*/ Select @TempID = ID from [PVS] where ChannelID = @ChannelID and SourceID = @SourceID; if @TempID is null Insert into [PVS]([ChannelID],[SourceID],[HourRate],[HourTimes],[DayRate],[DayTimes],[WeekRate],[WeekTimes],[MonthRate],[MonthTimes],[YearRate],[YearTimes],[Total]) Values(@ChannelID,@SourceID,@HourRate,@NowHourTimes,@DayRate,@NowDayTimes,@WeekRate,@NowWeekTimes,@MonthRate,@NowMonthTimes,@YearRate,@NowYearTimes,@Total); else Update [PVS] set [HourRate]=@HourRate,[HourTimes]=@NowHourTimes,[DayRate]=@DayRate,[DayTimes]=@NowDayTimes,[WeekRate]=@WeekRate,[WeekTimes]=@NowWeekTimes,[MonthRate]=@MonthRate,[MonthTimes]=@NowMonthTimes,[YearRate]=@YearRate,[YearTimes]=@NowYearTimes,[Total]=@Total where ID = @TempID; end GO
CREATE TABLE [dbo].[PV]( [ID] [int] IDENTITY(1,1) NOT NULL, [ChannelID] [int] NOT NULL, [SourceID] [int] NOT NULL, [Times] [int] NOT NULL, [Y] [smallint] NULL, [M] [tinyint] NULL, [W] [tinyint] NULL, [D] [tinyint] NULL, [H] [tinyint] NULL, CONSTRAINT [PK_PV] PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO ALTER TABLE [dbo].[PV] ADD CONSTRAINT [DF_PV_Times] DEFAULT ((0)) FOR [Times] GO ALTER TABLE [dbo].[PV] ADD CONSTRAINT [DF_PV_Y] DEFAULT ((2000)) FOR [Y] GO ALTER TABLE [dbo].[PV] ADD CONSTRAINT [DF_PV_M] DEFAULT ((1)) FOR [M] GO ALTER TABLE [dbo].[PV] ADD CONSTRAINT [DF_PV_W] DEFAULT ((1)) FOR [W] GO ALTER TABLE [dbo].[PV] ADD CONSTRAINT [DF_PV_D] DEFAULT ((1)) FOR [D] GO ALTER TABLE [dbo].[PV] ADD CONSTRAINT [DF_PV_H] DEFAULT ((0)) FOR [H] GO
CREATE TABLE [dbo].[PVS]( [ID] [int] IDENTITY(1,1) NOT NULL, [ChannelID] [int] NOT NULL, [SourceID] [int] NOT NULL, [HourRate] [float] NULL, [HourTimes] [int] NULL, [DayRate] [float] NULL, [DayTimes] [int] NULL, [WeekRate] [float] NULL, [WeekTimes] [int] NULL, [MonthRate] [float] NULL, [MonthTimes] [int] NULL, [YearRate] [float] NULL, [YearTimes] [int] NULL, [Total] [int] NULL, CONSTRAINT [PK_PVS] PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO
热心网友 时间:2022-04-15 03:40
UV指的是访客,我们可以用两个数值标准来统计访问某网站的访客,即“访问次数”和“访客(问)数”,访问次数和访客数是两个不同的概念。
pv是page view的缩写,即页面浏览量。通常是衡量一个网络新闻频道或网站甚至一条网络新闻的主要指标。网页浏览数是评价网站流量最常用的指标之一,简称为PV。监测网站PV的变化趋势和分析其变化原因是很多站长定期要做的工作。
扩展资料
对于网吧、单位、学校上网的用户:这些场所一般都是采用局域网共享上网的方式,只有一个IP地址接入互联网,此种情况就有可能出现访客数大于IP数,比如某单位内有多人访问A站点,但是整个单位的公网IP出口就只有一个
那么无论该单位里在当日有多少人次访问A站点,这些用户为A站点贡献的IP数为1,除非该单位的IP地址发生了变化,相反,这些用户为A站点带来的访客数就是该单位内当日访问A站点的实际人数了。
由此可见,访客比IP更具说服力,只不过我们平时比较关心IP罢了。一个网站的IP数与访客数是相近的,有可能IP数>访客数,也有可能IP数<访客数,
当然也有可能是相等的,这取决于网站的用户访问情况。而PV则是永远都是大于等于IP和访客的,因为PV是重复统计的。
参考资料来源:百度百科-访客
参考资料来源:百度百科-pv
热心网友 时间:2022-04-15 04:58
1、PV是page view的缩写,即页面浏览量,通常是衡量一个网络新闻频道或网站甚至一条网络新闻的主要指标。
网页一般通过URL或标题(html title)来标识,大多数工具都提供了类似的定义方法]关于PV的统计要考虑2种特殊情况:
一是从服务器返回错误网页或重定向网页时,是否计数以及如何配置;
二是本地或网关服务器的缓存生效时是否计数。
2、UV是unique visitor的简写,是指通过互联网访问、浏览这个网页的自然人。
UV是一个反映实际使用者的概念,每个UV相对于每个IP,更加准确地对应一个实际的浏览者。使用UV作为统计量,可以更加准确了解单位时间内实际上有多少个访问者来到了相应的页面。
扩展资料
一个简单的pv数据,其实是多种因素综合贡献的结果,所以有时的pv涨落,实在不是完全可以通过编辑手段来加以引导和影响的。知道这一点很重要。盲目的不加具体分析的以pv来衡量成败好坏,是不合理的。
在社会科学研究中,这种区分不同因素对某一个现象的贡献,就是所谓的详析模式。很多我们看似不变的东西,其实内部构成比例上发生了很大的变化。而有些看似变化的东西,其相对关系其实没有什么变化,只是一种单纯的数量上的涨落。
网站说日均IP/ PV 访问量约为600 / 2400的意思是,今天访问首页次数为2400次,访问IP为600个。也就是说这600个IP一共访问首页2400次。
通常说的网站流量(traffic)是指网站的访问量,是用来描述访问一个网站的用户数量以及用户所浏览的网页数量等指标,常用的统计指标包括网站的用户数量、总用户数量(含重复访问者)、网页浏览数量、每个用户的页面浏览数量、用户在网站的平均停留时间等。
恢复方式:
1、网站原创内容开始收录
2、加大外链的建设力度
3、长尾关键词开始出现排名恢复
参考资料来源:百度百科-pv (page view,页面浏览量)
参考资料来源:百度百科-UV (网站访客)
热心网友 时间:2022-04-15 06:32
PV是page view的简写,是指页面刷新的次数,每一次页面刷新,就算做一次pv流量。 UV是unique visitor的简写,是指用户,即不同的、通过互联网访问、浏览网页的人。热心网友 时间:2022-04-15 08:24
访问人数(UV) 页面(PV)