cal-itp / benefits

Transit benefits enrollment, minus the paperwork.
https://docs.calitp.org/benefits
GNU Affero General Public License v3.0
27 stars 9 forks source link

Feat: add properties for UTM codes #2056

Closed lalver1 closed 5 months ago

lalver1 commented 5 months ago

Closes #2034.

Uses request.GET.get() to get the UTM code. If a UTM code is not present in the query string, returns null for that UTM code.

How to test

Using a local instance of benefits, send a request that looks something like http://localhost:port/?utm_campaign=transit. Verify that the property utm_campaign has been added to event_properties and user_properties.

Browser Debug Message
image image
github-actions[bot] commented 5 months ago

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  benefits/core
  analytics.py
Project Total  

This report was generated by python-coverage-comment-action

lalver1 commented 5 months ago

Looks like test_Event_update_event_properties() and test_Event_update_user_properties() in test_analytics.py already test the feature added in this PR, so new tests may not be required.

lalver1 commented 5 months ago

Thanks, that makes sense. I added 4 new tests to test the new behavior of ViewedPageEvent. They are very similar to the Event tests but I think that this is ok since the new behavior of ViewedPageEvent is similar to the behavior of Event.

lalver1 commented 5 months ago

Thanks @thekaveman and @angela-tran!