-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Amplitude events to the navbar "Create" menu #55843
Conversation
shared/haml/user_header.haml
Outdated
.project_link#view_all_projects | ||
= I18n.t("#{loc_prefix}view_all") | ||
= render inline: File.read(Rails.root.join('..', 'shared', 'haml', 'create_menu_event_logger.haml')), type: :haml, locals: {is_signed_out: current_user.nil?, options: create_drop_down_items.map{|entry| entry[:title]}.append("view_all")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used this line as reference for how to render a .haml
file that's in the /shared
directory. It wasn't working when I tried something simpler like = view :create_menu_event_logger
, I think because it was expecting something in a views
directory (which /shared
doesn't have).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like teacher tools will want to add more events to the top nav bar soon (mentioned in this slack message). Could we make this filename more generic to allow other teams to add events here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, will do!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I know we have some Amplitude quota restrictions -- @dmcavoy do you foresee any issues with that?
No - We should be fine. If it gets bad I can block the event directly in amplitude. |
* add click create dropdown event * add option select event * update file name * update menu options variable name * safe chain the map call * add safe chaining for append * simplify file reader for tests * only add event listeners if element is present
Add Amplitude events to the navbar to track when a signed-out user clicks the "Create" menu and if they click an option within the menu.
My main concern is that we've seen problems before with Amplitude not logging a click event when the click triggers a redirect, I think because it doesn't have time to fire off before leaving the page the user was on. The tricky part about it is that it appears to work locally (i.e. the Amplitude log appears in the console right before navigating to the given url) so it's tough to tell whether it will work on production. I have confidence that the menu click event will work fine, but since each menu option is an
<a>
tag, I worry that the option click events won't log on Amplitude. After discussing with Dani, the plan is to wait and see if it works or not, and if it doens't work we'll remove the option event and find a new way of tracking that information."Signed Out User Clicks Create Dropdown" event:
Shows for signed-out user
Does not show for signed-in user
"Signed Out User Selects Create Dropdown Option" event:
Shows for signed-out user
Does not show for signed-in user
Links
Jira ticket: here
Testing story
Local testing.
Follow-up work
Observe whether "Signed Out User Selects Create Dropdown Option" events show up in Amplitude, and if they don't find a workaround to track that information.