Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion app/controllers/api/schools_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ def create

if result.success?
@school = result[:school]
track_event('School - Created', school_id: @school.id)
track_event(
'School - Created',
school_id: @school.id,
first_landing_page: params[:first_landing_page],
marketing_parameters: marketing_parameters

@zetter-rpf zetter-rpf Jun 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if it would be easier to query in the data warehouse if all of the event properties were at the same level. It might just be harder to document and query if some are nested inside other attributes. This means we could query on events.properties['utm_source'] rather than events.properties['marketing_params']['utm_source'].

You should be able to do this by spatting the marketing parameters:

track_event('School - Created', **marketing_parameters, @school.id:, first_landing_page: params[:first_landing_page])

)
render :show, formats: [:json], status: :created
else
render json: {
Expand Down Expand Up @@ -77,6 +82,10 @@ def import

private

def marketing_parameters
params[:marketing_parameters]&.permit!&.to_h
end

def create_params
params.expect(
school: %i[name
Expand Down
Loading