update
This commit is contained in:
@@ -79,8 +79,8 @@ def track_click(tracking_id):
|
||||
"""
|
||||
Track link clicks and redirect to original article URL.
|
||||
|
||||
Logs the click event and redirects the user to the original article URL.
|
||||
Handles invalid tracking_id by redirecting to homepage.
|
||||
Logs the click event, updates user interest profile, and redirects the user
|
||||
to the original article URL. Handles invalid tracking_id by redirecting to homepage.
|
||||
Ensures redirect completes within 200ms.
|
||||
|
||||
Args:
|
||||
@@ -115,6 +115,19 @@ def track_click(tracking_id):
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
# Update user interest profile (Phase 3)
|
||||
subscriber_email = tracking_record.get('subscriber_email')
|
||||
keywords = tracking_record.get('keywords', [])
|
||||
category = tracking_record.get('category', 'general')
|
||||
|
||||
if subscriber_email and subscriber_email != 'anonymized':
|
||||
try:
|
||||
from services.interest_profiling_service import update_user_interests
|
||||
update_user_interests(subscriber_email, keywords, category)
|
||||
except Exception as e:
|
||||
# Don't fail the redirect if interest update fails
|
||||
print(f"Error updating user interests: {str(e)}")
|
||||
except Exception as e:
|
||||
# Log error but still redirect
|
||||
print(f"Error tracking click for {tracking_id}: {str(e)}")
|
||||
|
||||
Reference in New Issue
Block a user