Do stats collection from Netlify in aggregate#13
Open
kingdonb wants to merge 1 commit intofluxcd:mainfrom
Open
Do stats collection from Netlify in aggregate#13kingdonb wants to merge 1 commit intofluxcd:mainfrom
kingdonb wants to merge 1 commit intofluxcd:mainfrom
Conversation
This is the laziest way to get all the Top Pages info, future enhancements could include going back to get older data, or some improved slicing and dicing/visualization of the data. Signed-off-by: Kingdon Barrett <kingdon@weave.works>
Member
Author
|
I think the data will be more interesting if it's tagged and posted to a database of some kind, so you can drill down into a particular week and find out what moved the needle during that week. Happy to take any requests if there are ideas for how to make this better. |
kingdonb
commented
Apr 25, 2022
| git checkout netlify-stats && git pull --ff-only | ||
| git checkout main && git pull --ff-only | ||
|
|
||
| bundle exec --gemfile collect-stats/Gemfile collect-stats/collect-stats.rb |
Member
Author
There was a problem hiding this comment.
If you're testing and this hasn't been merged yet, you'll want to run this bundle exec command instead of the script (as it won't be present in the main branch yet)
It does a bunch of git checkout stuff and branch switching internally, so I just added these to avoid leaving the clone in an unpredictable or detached state after the script runs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the laziest way to get all the Top Pages info, quick Ruby script I threw together.
Future enhancements could include going back to get older data, or some improved slicing and dicing/visualization of the data. Unfortunately what we've learned from looking over the data this once is that Netlify only provides analytics about the top 10 pages each day.
So unless something made it to the Top-10 list on at least one given day, it won't show up on this list at all.
Still, better than nothing! Here is the output from running this script today, in the future I imagine we have something better to report on aggregate statistics over arbitrary spans and this goes away completely.
We can run this script again tomorrow and it will show 44 days of accumulated data, the day after we'd get 45... it's all based on when we started taking snapshots of this information, as it scans through each git commit we've made through automation every day, where we got the numbers from the netlify "pages" metric.
I think that Netlify actually keeps the data for longer than 30 days, we just need a way to add them to the git history that won't be too impossible to sort out later, (we could just add a script to go back and poll the rest of the days we've missed since the first of the year... depending on when we did enable analytics and how interested we are in that historical data!)
I realize this is not the easiest way to consume this information but we have limited capabilities in terms of what we can access from this API, what we've planned for, and what else has been done for us upstream already at NiklasMerz/netlify-analytics-collector. Most of this work was done already there.
The next obvious step to enhance would be to see how much further back we can go. I think the 30 day limitation is imposed by the GitHub action and how it works, not by Netlify's upstream API, (but I can't be sure without spending some more time on it and trying to write my own API client next. That doesn't sound like too much work, maybe one for next week...)