Skip to content
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

Feat: add properties for UTM codes #2056

Merged
merged 2 commits into from
May 1, 2024
Merged

Feat: add properties for UTM codes #2056

merged 2 commits into from
May 1, 2024

Conversation

lalver1
Copy link
Member

@lalver1 lalver1 commented Apr 25, 2024

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

@lalver1 lalver1 self-assigned this Apr 25, 2024
@github-actions github-actions bot added deployment-dev [auto] Changes that will trigger a deploy if merged to dev back-end Django views, sessions, middleware, models, migrations etc. labels Apr 25, 2024
Copy link

github-actions bot commented Apr 25, 2024

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 lalver1 force-pushed the feat/add-utm-code branch 2 times, most recently from 38c9a65 to 7e63fc9 Compare April 26, 2024 14:07
@lalver1
Copy link
Member Author

lalver1 commented Apr 26, 2024

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 lalver1 marked this pull request as ready for review April 26, 2024 16:09
@lalver1 lalver1 requested a review from a team as a code owner April 26, 2024 16:09
@lalver1 lalver1 added the analytics App event tracking, instrumentation, logging: Metabase, Amplitude label Apr 26, 2024
Copy link
Member

@thekaveman thekaveman left a comment

Choose a reason for hiding this comment

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

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.

True, those functions have been tested. But this PR is adding behavior to the ViewedPageEvent, and so tests could (should) be written for that.

@lalver1
Copy link
Member Author

lalver1 commented Apr 26, 2024

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 lalver1 requested a review from thekaveman April 26, 2024 20:37
@lalver1 lalver1 force-pushed the feat/add-utm-code branch from 23e7262 to 7bfe7f0 Compare April 30, 2024 14:36
Copy link
Member

@thekaveman thekaveman left a comment

Choose a reason for hiding this comment

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

Nice work to keep on this @lalver1! There's still some refinement needed for the tests, hopefully my comments make sense. LMK if you want to chat.

tests/pytest/core/test_analytics.py Outdated Show resolved Hide resolved
tests/pytest/core/test_analytics.py Outdated Show resolved Hide resolved
@lalver1 lalver1 force-pushed the feat/add-utm-code branch from 7bfe7f0 to 7a58def Compare May 1, 2024 01:08
@lalver1 lalver1 changed the title Feat: Add properties for UTM codes Feat: add properties for UTM codes May 1, 2024
Copy link
Member

@thekaveman thekaveman left a comment

Choose a reason for hiding this comment

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

Fantastic work @lalver1! Thanks for sticking with the tests, looks great!

Copy link
Member

@angela-tran angela-tran left a comment

Choose a reason for hiding this comment

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

This looks great!

@lalver1
Copy link
Member Author

lalver1 commented May 1, 2024

Thanks @thekaveman and @angela-tran!

@lalver1 lalver1 merged commit b2c5642 into dev May 1, 2024
13 checks passed
@lalver1 lalver1 deleted the feat/add-utm-code branch May 1, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analytics App event tracking, instrumentation, logging: Metabase, Amplitude back-end Django views, sessions, middleware, models, migrations etc. deployment-dev [auto] Changes that will trigger a deploy if merged to dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add custom properties for UTM code information
3 participants