Skip to content

Commit

Permalink
📈 remove tracking of archive page
Browse files Browse the repository at this point in the history
  • Loading branch information
FredrikMorstad committed Dec 29, 2023
1 parent 6fe0adc commit c2b75c2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/api/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ async def add_unique_member_visit(request: Request, background_task: BackgroundT
return Response(status_code=200)

def register_page_visit(db, page):
ts = datetime.now()
# keywords the api should not track
untrackable_keywords = ["admin", "archive"]

# don't track admin page visits
if "admin" in page:
# remove admin logs
return
for keyword in untrackable_keywords:
if keyword in page:
return

ts = datetime.now()
res = db.pageVisitLog.insert_one({"timestamp": ts, "metaData": page})
if not res:
logging.error(f"could not insert visit on page: {page}")
Expand Down

0 comments on commit c2b75c2

Please sign in to comment.