Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Order search results by most viewed pages #5968
Do you have an idea about how to implement this?
I have some questions:
HTMLFile object seems to be the right place -- but they get deleted and recreated after every build, so we will lost all the data
We want the data into elasticsearch -- so yes
We can use Google Analytics, I don't know if they have an API for this or something else.
Once we have the data, I don't think it should be very complicated. I will research about this point.
@davidfischer Can we somehow use Google Analytics here?
Some simple thoughts on this:
Storing the data
We can store the data in a separate model. We can't store in HTMLFile model because these gets deleted and recreated after a build. Also, no use of ForeignKey because we don't want the relationships to be null when improted files objects are deleted and recreated.
Updating the data
I believe we can have API endpoint for it. Send a API request as soon as the page loads which increases its count by one.
Syncing the data with elasticsearch
Just a query to our new "count model" should be enough to get the data.
I think we should likely update it via the footer API, not with JS. I think it should basically work exactly the same as the Search Analytics, except that we aggregate the counts by day for each (project/version/page) grouping. We should likely do the same for Search Analytics, where we aggregate the
I think the main goals here are how we want to query/display the data. I'm imagining similar to search analytics:
I'm imagining something similar to this: https://github.com/readthedocs/readthedocs.org/graphs/traffic -- but we likely won't track referrer to start.