cityofaustin / atd-moped

A comprehensive mobility project tracking platform for Austin, Texas.
https://mobility.austin.gov/moped/
4 stars 3 forks source link

Add map user analytics event and save map toggle state in search params #1354

Closed mddilley closed 5 months ago

mddilley commented 5 months ago

Associated issues

Closes https://github.com/cityofaustin/atd-data-tech/issues/17601 Closes https://github.com/cityofaustin/atd-data-tech/issues/17480

This PR adds a user analytics event so we can track adoption of the projects map, and it also stores the map toggle state in the query params so filtered map view urls can be saved or shared.

Testing

URL to test:

Local

Steps to test:

  1. Start the local stack and explore the moped_user_events table in your DB GUI. You should see that the event_name column has a new value in its constraint called projects_map_load
  2. In your local editor, go to the projects list view and toggle the map switch on. You should see a new row in the moped_user_events table capturing this event
  3. Also, notice that the url query parameters include a new k/v pair for map which is either true or false
  4. Test toggling the map on, adding some advanced filters, and then copying your url
  5. In a new tab, paste the url and make sure that the projects map loads with your filters applied
  6. You can also test clicking on project features and then visiting a linked project in the sidebar. Click the < All Projects link in the project summary page, and see that you are linked to the map with your previous filters applied

Ship list

mddilley commented 5 months ago

@chiaberry Thanks for catching that!! In previous down migrations, it looks like we dropped event rows that violate the constraint before updating it in the down migration. I'll do the same here. 🙏