-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/store user traffic #84
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FredrikMorstad
force-pushed
the
feature/store_user_traffic
branch
2 times, most recently
from
October 26, 2023 06:28
02bf98d
to
b401e7a
Compare
otytlandsvik
requested changes
Nov 2, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice stuff! 🚀 Left some nitpicky comments on a few things I think you should consider.
FredrikMorstad
force-pushed
the
feature/store_user_traffic
branch
from
November 5, 2023 20:21
b401e7a
to
c5798b0
Compare
FredrikMorstad
force-pushed
the
feature/store_user_traffic
branch
from
November 5, 2023 20:23
c5798b0
to
00cfac2
Compare
otytlandsvik
approved these changes
Nov 7, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tracking of unique visits and page visits 🕵️
Unique visits
Anonymous tracking of unique visits per day
Uses bloom filter to check if a user has visited today. This allows users to be tracked without storing any user information meaning we don't have to have "terms and condition" in fronted.
After the day is over the bloom filter is removed from the database.
Mongodb timeseries
Uses time series to store the timestamp when the unique users was detected. Mongodb time series is specialised on storing these kinds of data and allow for fast queries and efficient storage.
Get unique visits
To allow minimal work for the frontend the endpoint gives the date with different intervals based on the range specified in the request. Meaning when the interval is under 48 hours the data is grouped to their hour when over the data is grouped to their day.
Page visits
Tracks visits on different pages on the website
The api blindly accepts a path and store it in a time series collection. This allows the fronted to send post request with different page visits.
As the fronted sends the
location.pathname
many pages will have path name contains their uuid. To allow the pages to be displayed with more readable names the api has function for finding the database object based on the path.Most viewed pages last 30 days:
Endpoint for giving the 5 most viewed pages in the last 30 days
Resolves td-org-uit-no/tdctl-frontend#71
Something to consider 💡
Reddis cache
Setup reddis cache for the 30 most viewed page
- This cache can do the initial work of checking the most visited page at startup and then keep track in memory nd return fast results.
Stats service