diff --git a/openedx/core/djangoapps/user_authn/views/register.py b/openedx/core/djangoapps/user_authn/views/register.py index 6ca5234e26..e522f8a0ba 100644 --- a/openedx/core/djangoapps/user_authn/views/register.py +++ b/openedx/core/djangoapps/user_authn/views/register.py @@ -350,6 +350,7 @@ def _link_user_to_third_party_provider( def _track_user_registration(user, profile, params, third_party_provider, registration): """ Track the user's registration. """ if hasattr(settings, 'LMS_SEGMENT_KEY') and settings.LMS_SEGMENT_KEY: + is_marketable = params.get('marketing_emails_opt_in') in ['true', '1'] traits = { 'email': user.email, 'username': user.username, @@ -361,10 +362,10 @@ def _track_user_registration(user, profile, params, third_party_provider, regist 'address': profile.mailing_address, 'gender': profile.gender_display, 'country': str(profile.country), - 'is_marketable': params.get('marketing_emails_opt_in') == 'true' + 'is_marketable': is_marketable } if settings.MARKETING_EMAILS_OPT_IN and params.get('marketing_emails_opt_in'): - email_subscribe = 'subscribed' if params.get('marketing_emails_opt_in') == 'true' else 'unsubscribed' + email_subscribe = 'subscribed' if is_marketable else 'unsubscribed' traits['email_subscribe'] = email_subscribe # .. pii: Many pieces of PII are sent to Segment here. Retired directly through Segment API call in Tubular. @@ -386,7 +387,7 @@ def _track_user_registration(user, profile, params, third_party_provider, regist } # VAN-738 - added below properties to experiment marketing emails opt in/out events on Braze. if params.get('marketing_emails_opt_in') and settings.MARKETING_EMAILS_OPT_IN: - properties['marketing_emails_opt_in'] = params.get('marketing_emails_opt_in') == 'true' + properties['marketing_emails_opt_in'] = is_marketable # DENG-803: For segment events forwarded along to Hubspot, duplicate the `properties` section of # the event payload into the `traits` section so that they can be received. This is a temporary