saq1b commited on
Commit
d44db5c
·
verified ·
1 Parent(s): 0569f9b

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -0
main.py CHANGED
@@ -1200,6 +1200,11 @@ class VisitorData(BaseModel):
1200
  async def track_visitor(visitor: VisitorData, request: Request):
1201
  """Records visitor information and adds it to the visitor queue"""
1202
 
 
 
 
 
 
1203
  # Get client IP (for internal tracking, not included in webhook)
1204
  client_host = request.client.host if request.client else "Unknown"
1205
 
 
1200
  async def track_visitor(visitor: VisitorData, request: Request):
1201
  """Records visitor information and adds it to the visitor queue"""
1202
 
1203
+ # Filter out unwanted paths like embeds, frames, etc.
1204
+ if any(unwanted in visitor.path.lower() for unwanted in ['embed', 'inner-frame', 'frame-minified']):
1205
+ logger.info(f"Skipping tracking for non-standard path: {visitor.path}")
1206
+ return {"status": "skipped", "reason": "non-standard path"}
1207
+
1208
  # Get client IP (for internal tracking, not included in webhook)
1209
  client_host = request.client.host if request.client else "Unknown"
1210