Skip to content

Commit

Permalink
fix: tracker context issue (#36247)
Browse files Browse the repository at this point in the history
Co-authored-by: Hassan Raza <h.raza@192.168.1.12>
  • Loading branch information
hassan-raza-1 and Hassan Raza authored Feb 18, 2025
1 parent f81e374 commit 5db14d2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions openedx/core/djangoapps/notifications/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,13 @@ def notification_preference_unsubscribe_event(user):
"""
Emits an event when user clicks on one-click-unsubscribe url
"""
event_data = {
context_data = {
'user_id': user.id,
'username': user.username,
'event_type': 'email_digest_unsubscribe'
'username': user.username
}
tracker.emit(NOTIFICATION_PREFERENCE_UNSUBSCRIBE, event_data)
event_data = context_data.copy()
event_data['event_type'] = 'email_digest_unsubscribe'

with tracker.get_tracker().context(NOTIFICATION_PREFERENCE_UNSUBSCRIBE, context_data):
tracker.emit(NOTIFICATION_PREFERENCE_UNSUBSCRIBE, event_data)
segment.track(user.id, NOTIFICATION_PREFERENCE_UNSUBSCRIBE, event_data)

0 comments on commit 5db14d2

Please sign in to comment.