def record_utm_registration_attribution(request, user):
 utm_cookie_name = RegistrationCookieConfiguration.current().utm_cookie_name
 utm_cookie = request.COOKIES.get(utm_cookie_name)
 if (user and utm_cookie):
  utm = json.loads(utm_cookie)
  for utm_parameter_name in REGISTRATION_UTM_PARAMETERS:
   utm_parameter = utm.get(utm_parameter_name)
   if utm_parameter:
    UserAttribute.set_user_attribute(user, REGISTRATION_UTM_PARAMETERS.get(utm_parameter_name), utm_parameter)
  created_at_unixtime = utm.get('created_at')
  if created_at_unixtime:
   created_at_datetime = datetime.datetime.fromtimestamp((int(created_at_unixtime) / float(1000)), tz=UTC)
   UserAttribute.set_user_attribute(user, REGISTRATION_UTM_CREATED_AT, created_at_datetime)

def record_utm_registration_attribution ( request , user ) : utm_cookie_name = RegistrationCookieConfiguration . current ( ) . utm_cookie_name utm_cookie = request . COOKIES . get ( utm_cookie_name ) if ( user and utm_cookie ) : utm = json . loads ( utm_cookie ) for utm_parameter_name in REGISTRATION_UTM_PARAMETERS : utm_parameter = utm . get ( utm_parameter_name ) if utm_parameter : UserAttribute . set_user_attribute ( user , REGISTRATION_UTM_PARAMETERS . get ( utm_parameter_name ) , utm_parameter ) created_at_unixtime = utm . get ( 'created_at' ) if created_at_unixtime : created_at_datetime = datetime . datetime . fromtimestamp ( ( int ( created_at_unixtime ) / float ( 1000 ) ) , tz = UTC ) UserAttribute . set_user_attribute ( user , REGISTRATION_UTM_CREATED_AT , created_at_datetime )
attribute this users registration to the latest utm referrer .