Skip to content

Commit

Permalink
attribute cohort changes to user/org profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinSchneider committed Apr 23, 2024
1 parent f7591b9 commit 893920e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/app/lib/profile_tags/cohort_applier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,16 @@ def event_for_ingestion(profile, event_name)
properties[:user_unique_identifier] = profile.user_unique_identifier
properties[:profile_name] = profile.full_name if profile.full_name.present?
properties[:profile_email] = profile.email
# so it gets attributed to the user during event preparation ingestion
properties[:user] = { identifier: profile.user_unique_identifier }
else
# important so the event gets associated with the organization
properties[:organization_id] = profile.organization_unique_identifier
properties[:organization_name] = profile.name if profile.name.present?
properties[:organization_unique_identifier] = profile.organization_unique_identifier
properties[:profile_name] = profile.name if profile.name.present?
# so it gets attributed to the organization during event preparation ingestion
properties[:organization] = { identifier: profile.organization_unique_identifier }
end
# not idempotent...
Ingestion::EventsPreparer.format_for_events_to_prepare_queue(
Expand Down

0 comments on commit 893920e

Please sign in to comment.