The Little Guy Posted September 15, 2008 Share Posted September 15, 2008 Does this sound correct? I am trying to find average number of page views per user so... I have this: # $row['totalCount'] = total number of pages viewed # $row['uniqueCount'] = total number unique ip addresses round($row['totalCount'] / $row['uniqueCount'],2); Link to comment https://forums.phpfreaks.com/topic/124336-average/ Share on other sites More sharing options...
Mchl Posted September 15, 2008 Share Posted September 15, 2008 I'd say $row['uniqueCount'] / $row['totalCount'] Nah... I was wrong. Link to comment https://forums.phpfreaks.com/topic/124336-average/#findComment-642062 Share on other sites More sharing options...
obsidian Posted September 15, 2008 Share Posted September 15, 2008 I'd say $row['uniqueCount'] / $row['totalCount'] Wouldn't that always return a number less than 1, though? I think he has the right of it, since he wants an average number of page hits per visit... so: <?php $total = 100; // 100 page hits $users = 10; // 10 unique visitors $avg = $total / $users; // 10 hits per visitor ?> This would not be accurate: <?php $total = 100; // 100 page hits $users = 10; // 10 unique visitors $avg = $users / $total; // 1/10 hits per visitor -- makes no sense ?> Link to comment https://forums.phpfreaks.com/topic/124336-average/#findComment-642066 Share on other sites More sharing options...
The Little Guy Posted September 15, 2008 Author Share Posted September 15, 2008 @mchl are you sure? uniqueCount will always be equal to or less than totalCount... Link to comment https://forums.phpfreaks.com/topic/124336-average/#findComment-642068 Share on other sites More sharing options...
Maq Posted September 15, 2008 Share Posted September 15, 2008 Of course it will. I guess you could argue that it could be equal but that would almost never happen... Link to comment https://forums.phpfreaks.com/topic/124336-average/#findComment-642073 Share on other sites More sharing options...
sasa Posted September 15, 2008 Share Posted September 15, 2008 can we see SQL for select data from db Link to comment https://forums.phpfreaks.com/topic/124336-average/#findComment-642081 Share on other sites More sharing options...
The Little Guy Posted September 16, 2008 Author Share Posted September 16, 2008 using Mchl's code, could I find a bouce rate percentage? bounce rate = The percentage of visits where the visitor enters and exits at the same page without visiting any other pages on the site in between. $pagesAccessed = 1000; $uniquePeople = 100; $bounceRate = ($uniquePeople / $pagesAccessd) * 100; Link to comment https://forums.phpfreaks.com/topic/124336-average/#findComment-643224 Share on other sites More sharing options...
obsidian Posted September 16, 2008 Share Posted September 16, 2008 using Mchl's code, could I find a bouce rate percentage? bounce rate = The percentage of visits where the visitor enters and exits at the same page without visiting any other pages on the site in between. $pagesAccessed = 1000; $uniquePeople = 100; $bounceRate = ($uniquePeople / $pagesAccessd) * 100; You really can't find a bounce rate unless you know exactly how many pages came from each individual user. Your number of page hits really doesn't apply to the bounce rate average, since "bounce" is actually like a boolean for each user. So, if you have hits per user, you could calculate it if you're careful. Link to comment https://forums.phpfreaks.com/topic/124336-average/#findComment-643253 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.