I am keeping track of article hits by storing each page view in a table along with the session ID, I then use the session ID to weed out (count(distinct session)
) multiple hits in the users session lifetime.
But how unique is the Laravel session ID? Should I also take other things into consideration, such as the time to avoid incorrect grouping?
Update: I adjusted my SQL to take the date into account as well:
select count(distinct session, DATE(created_at)) as aggregate from `article_views` where `article_id` = ? and `agent` NOT LIKE '%bot%'