|
May 18, 2012
|
|
Search_Blog
|
 |
|
|
|
|
|
Blog_Archive
|
 |
|
|
|
|
|
|
|
|
|
|
|
|
Blog
|
|
|
View_Blog
|
 |
|
Jun
10
Written by:
host
Wednesday, June 10, 2009 10:23 AM
In the last few years, the number of way that someone can view your site has increased considerably. The growth in different browsers and the growth in cell phones, the change is amazing.
As you may have noted from other blog posts and several Dotnetnuke forum posts, I have been attempting to get people to move off IE6 to any of the current new browsers. So I was somewhat surprised by the following stored procedure in Dotnetnuke:
CREATE PROCEDURE dbo.Getsitelog2 @PortalId INT, @PortalAlias NVARCHAR(50), @StartDate DATETIME, @EndDate DATETIME AS SELECT sitelog.datetime, 'Name' = CASE WHEN sitelog.userid IS NULL THEN NULL ELSE users.firstname + ' ' + users.lastname END, 'Referrer' = CASE WHEN sitelog.referrer LIKE '%' + @PortalAlias + '%' THEN NULL ELSE sitelog.referrer END, 'UserAgent' = CASE WHEN sitelog.useragent LIKE '%MSIE 1%' THEN 'Internet Explorer 1' WHEN sitelog.useragent LIKE '%MSIE 2%' THEN 'Internet Explorer 2' WHEN sitelog.useragent LIKE '%MSIE 3%' THEN 'Internet Explorer 3' WHEN sitelog.useragent LIKE '%MSIE 4%' THEN 'Internet Explorer 4' WHEN sitelog.useragent LIKE '%MSIE 5%' THEN 'Internet Explorer 5' WHEN sitelog.useragent LIKE '%MSIE 6%' THEN 'Internet Explorer 6' WHEN sitelog.useragent LIKE '%MSIE%' THEN 'Internet Explorer' WHEN sitelog.useragent LIKE '%Mozilla/1%' THEN 'Netscape Navigator 1' WHEN sitelog.useragent LIKE '%Mozilla/2%' THEN 'Netscape Navigator 2' WHEN sitelog.useragent LIKE '%Mozilla/3%' THEN 'Netscape Navigator 3' WHEN sitelog.useragent LIKE '%Mozilla/4%' THEN 'Netscape Navigator 4' WHEN sitelog.useragent LIKE '%Mozilla/5%' THEN 'Netscape Navigator 6+' ELSE sitelog.useragent END, sitelog.userhostaddress, tabs.tabname FROM sitelog LEFT OUTER JOIN users ON sitelog.userid = users.userid LEFT OUTER JOIN tabs ON sitelog.tabid = tabs.tabid WHERE sitelog.portalid = @PortalId AND sitelog.datetime BETWEEN @StartDate AND @EndDate ORDER BY sitelog.datetime DESC
This one of the several SiteLog Stored Procedures. As you can see it is a bit dated when it comes to defining the UserAgent.
You may want to update this procedure ... I have posted a request in Gemini so a future version of DNN will recognize the current browsers. DNNP-10180
Here is what I have used to replace the procedure:
ALTER procedure dbo.GetSiteLog2
@PortalId int,
@PortalAlias nvarchar(50),
@StartDate datetime,
@EndDate datetime
as
set nocount on
select SiteLog.DateTime,
'Name' =
case
when SiteLog.UserId is null then null
else Users.FirstName + ' ' + Users.LastName
end,
'Referrer' =
case
when SiteLog.Referrer like '%' + @PortalAlias + '%' then null
else SiteLog.Referrer
end,
'UserAgent' =
case
when charindex('MSIE 1', UserAgent) > 0 then 'IE1'
when charindex('MSIE 2', UserAgent) > 0 then 'IE2'
when charindex('MSIE 3', UserAgent) > 0 then 'IE3'
when charindex('MSIE 4', UserAgent) > 0 then 'IE4'
when charindex('MSIE 5', UserAgent) > 0 then 'IE5'
when charindex('MSIE 6', UserAgent) > 0 then 'IE6'
when charindex('MSIE 7', UserAgent) > 0 then 'IE7'
when charindex('MSIE 8', UserAgent) > 0 then 'IE8'
when charindex('Firefox', UserAgent) > 0 then 'FF'
when charindex('Opera', UserAgent) > 0 then 'Opera'
when charindex('Chrome', UserAgent) > 0 then 'Chrome'
when charindex('Gecko', UserAgent) > 0 then 'Safari'
when charindex('bot', UserAgent) > 0 then 'bot'
when charindex('slurp', UserAgent) > 0 then 'bot'
when charindex('crawler', UserAgent) > 0 then 'bot'
when charindex('spider', UserAgent) > 0 then 'bot'
when charindex('jeeves', UserAgent) > 0 then 'bot'
when charindex('google', UserAgent) > 0 then 'bot'
when charindex('ScoutJet', UserAgent) > 0 then 'bot'
when charindex('Charlotte', UserAgent) > 0 then 'bot'
when charindex('Yandex', Useragent) > 0 then 'bot'
when charindex('YahooSeeker', Useragent) > 0 then 'bot'
when charindex('Java/1.6', Useragent) > 0 then 'bot'
when charindex('Wells', Useragent) > 0 then 'bot'
when charindex('ia_archiver', Useragent) > 0 then 'bot'
when charindex('Mail.Ru', Useragent) > 0 then 'bot'
when charindex('Shelob', Useragent) > 0 then 'bot'
when charindex('Netscape', UserAgent) > 0 then 'Netscape'
when charindex('Mozilla', UserAgent) > 0 then 'Mozilla'
else 'Other'
end,
SiteLog.UserHostAddress,
Tabs.TabName
from
SiteLog
left outer join Users on SiteLog.UserId = Users.UserId
left outer join Tabs on SiteLog.TabId = Tabs.TabId
where
SiteLog.PortalId = @PortalId
and SiteLog.DateTime between @StartDate and @EndDate
order by
SiteLog.DateTime desc
You may also want to update GetSiteLog5 with a similiar change to the UserAgents
Hope this helps
Paul
Tags:
|
|
|
|
|
Blog_List
|
 |
|
|
|
|
|
|
|
|
|
|