I am using ASP.NET and want to calculate the difference between two times. Actually, I had a scenario to calculate the difference between the login and logout times.
For example, in organizations there is some particular limit for working hours. So if a user logs in at 9:00 AM in the morning and logs out at 5:00 PM in the evening, we need to calculate how much duration he stayed in the office (which is 8 hours in the present scenario ).
But I want to do this in ASP.NET. I calculate the duration between the two times but the problem is that:
if the first day I log in at 09:10:15 and log out at 17:20:55, the duration time is 08:10:40
if the second say I log in at 09:00:00 and log out at 10:50:20, the duration time is 01:50:20
The first day logout time and duration time is also updated. That means that the first day logout time takes the second day logout time (i.e. 10:50:20).
How to do this correctly?
You shouldn't store only time but date and operations type and find previous record on logout.
When it login type record You can calculate difference otherwise abnormal situation.
So on login - if previous record type is login - abnormal.
What You should do in abnormal situation depends on You.
But if you use web technology You must understand what user can never logout.
Related
EDIT
This post indicates that sessions should be interpreted as visitors for that hour.
Using the graph to identify which hour has the highest traffic and record
the number of visitors for that hour
I am looking at a Google Analytics report (Audience --> Overview) for a website. In section Audience --> Overview, I have selected Sessions vs. Select a metric. I have specified a frequency of Hourly.
I mouse clicked on a peak and saw
Thursday, January 17, 2019 10:00
Sessions:19,732
Is this telling me that I had 19,732 concurrent sessions open at 10:00? Or that in the hour between 9:00 and 10:00, that 19,732 sessions had been opened (and many likely closed)? Please note that
Avg. Session Duration = 00:09:07
I looked at How Count of Sessions is calculated and that leads me to believe that the 19,732 sessions is for the hour between 9:00 and 10:00.
Can someone confirm this?
Thank you.
Yes, that number would represent how many sessions were started during that hour.
You shouldn't interpret sessions as visitors/users. As one user can have many sessions during that hour. By default, max of 2 (new session at say the 5th minute, no activity, come back at the 35th minute, session 2).
In the REAL-TIME / Overview page, you can see how much people are currently browsing your site. Although, how do you know if this current value is good or bad? I would like to know how much people were browsing my site the same time the day before, so I would know if I have 5% more or less people.
Also, how would I know if the site is doing it better or worse than 1, 2 or 5 hours before? The REAL-TIME shows the last 30 minutes of per minute page-views, but how do I know if the site is going down or up compared to a few hours before? 30 minutes is not enough.
Is there any add-on to add, custom modification to make, or free/paid service to complement?
You want to use the standard ("core") reporting. The dimensions that will help you are (UI / API):
Hour / ga:hour: A two-digit hour of the day ranging from 00-23 in the timezone configured for the account. This value is also corrected for daylight savings time. If the timezone follows daylight savings time, there will be an apparent bump in the number of sessions during the changeover hour (e.g., between 1:00 and 2:00) for the day per year when that hour repeats. A corresponding hour with zero sessions will occur at the opposite changeover. (Google Analytics does not track user time more precisely than hours.)
Hour of day / ga:dateHour: Combined values of ga:date and ga:hour formated as YYYYMMDDHH
Date Hour and Minute / ga:dateHourMinute: Combined values of ga:date, ga:hour and ga:minute formated as YYYYMMDDHHMM
Hour Index / ga:nthHour: The index for each hour in the specified date range. The index for the first hour of the first day (i.e., start-date) in the date range is 0, for the next hour 1, and so on
With the UI you can add a secondary dimension to reports or build custom reports, with the API you can need to build your requests from scratch (try the explorer, official API doc).
I am building an internal intranet system, that will call up sales orders and I need it to remember the last sales order number they were looking at, even though I could put this in a database and call up the info I was wondering if I could use a session cookie for a longer time than 20 minutes I want to set the expiry to expiry time to a day or a week or so;
Session("SalesOrder") = 105793 'STORE THIS FOR A DAY OR WEEK
I hope you can help.
Background:
I have a Google Analytics account using which I am tracking user activity for web and mobile app. After logging into your account and choosing the web property and the corresponding view, you generally see a dashboard with quick stats like Pageviews, Users, Sessions, Pages/Sessions, Avg. Session Duration, Bounce Rate and percentage of new sessions. You can change the time period (from the top right area of the Dashboard) to get the same stats for that period.
Problem:
Last week, I was interested in the three main stats: Page views, Users and Sessions for a particular day - say, day A. The dashboard showed the following stats:
Pageviews - 1,660,137
Users - 496,068
Sessions - 983,549
This report was based on 100% of sessions.
I go back to the dashboard TODAY and check the same stats for the same day A. Here's what I saw:
Pageviews - 1,660,137
Users - 511,071
Sessions - 1,005,517
This report is also based on 100% of sessions.
Nothing was changed in the tracking code for the web and mobile app. Could someone explain why I have this difference in the stats? Is this normal?
They need some time to update the system, otherwise their system would overwhelm
When you first create a profile it can take up to 48 -72 hours for it to start showing data.
After that time data will appear instantly in the Real-time reports.
Standard reports take longer to finish processing. You need to remember the amount of data that is being processed. Some of the data may appear in the standard reports after a few hours. The numbers have not completed processing for at least 24 hours, so anything you look at then will not be accurate.
When checking Google Analytics never look at todays or yesterdays numbers in the standards reports, if you want accurate information. Things get even more confusing when you consider time zones. When exactly is it yesterday? I have noticed numbers changing as far back as 48 hours. But Google Says in there documentation 24 hours. I am looking for the link in the documentation will post it when I find it.
Found it: Data Limits
Data processing latency
Processing latency is 24-48 hours. Standard accounts that send more
than 200,000 sessions per day to Google Analytics will result in the
reports being refreshed only once a day. This can delay updates to
reports and metrics for up to two days. To restore intra-day
processing, reduce the number of sessions you send to < 200,000 per
day. For Premium accounts, this limit is extended to 2 billion hits
per month.
So try doing the same thing again today but check your last day being Monday. When you check again next week the numbers should be correct.
According to:
http://analytics.blogspot.com/2011/08/update-to-sessions-in-google-analytics.html
the GA session cookie (__utmb cookie) expires when more than 30 minutes passed without any user input, traffic source changed OR at the end of a day.
What does this last condition mean, is it 24h max lifetime since the visit started, is a hard limit set to midnight (if yes, what timezone?)
The "end of day" is midnight according to the settings of the Google Analytics profile.
So, there's a single universal "midnight" for each profile; it doesn't vary by the location or time for the local user.
If you didn't manually alter it to your preferred time zone, the default value is set to GMT -0700 US Pacific.
You can manually change the time zone in your Profile Settings:
Note that changing your time zone is a disruptive activity, since your GA data will be affected for the number of hours you change.
If you change forward in time, you'll end up with "empty" hours on the day of the transition.
If you change back in time, you'll end up with double-filled hours on the day of the transition.