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
Track pageviews for custom pages #20879
base: main
Are you sure you want to change the base?
Conversation
Uffizzi Ephemeral Environment Deploying☁️ https://app.uffizzi.com/github.com/forem/forem/pull/20879 ⚙️ Updating now by workflow run 9019123388. What is Uffizzi? Learn more! |
class AddPageToPageViews < ActiveRecord::Migration[7.0] | ||
disable_ddl_transaction! | ||
|
||
def change | ||
add_reference :page_views, :page, null: true, index: {algorithm: :concurrently} | ||
end | ||
end |
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'm a little bit conflicted on this. The ideal way to go about this is to make a polymorphic association/model that will then allow any model to be in relation with PageView but I can see this to be a quick way to get this feature implemented first.
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.
Yup, I discussed this with @benhalpern. Data migration was the main concern with a polymorphic approach.
Are there any ways of sidestepping this issue if we went down a polymorphic approach?
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.
Yeah I think this has to be the first take on this as the path forward
What type of PR is this? (check all applicable)
Description
Adds page_id to
PageViews
and tracks page views when a user visits a page.Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Please replace this line with instructions on how to test your changes, a note
on the devices and browsers this has been tested on, as well as any relevant
images for UI changes.
Added/updated tests?
We encourage you to keep the code coverage percentage at 80% and above.
have not been included
[optional] Are there any post deployment tasks we need to perform?
[optional] What gif best describes this PR or how it makes you feel?