问题
I want to make a list of the most viewed posts in the last month. I found almost zero info about this.
Is it possible? Can it be done using Google Analytics or something?
回答1:
I don't think this can be done with the built-in toolset of Ghost. Since I have found almost zero info about this like you, I decided to create my own implementation.
First, you have to integrate GA tracking to your site. Here's more info on how to do that: https://help.ghost.org/article/16-google-analytics
I created a custom Ghost helper to download Google Analytics metrics. Please note that setting up a custom helper is unfortunately not very well documented and definitely not supported.
Here's the Github repository with the source code: https://github.com/conwid/GhostHelpers
Check out the project's wiki.
- There information on how to set up a custom helper: https://github.com/conwid/GhostHelpers/wiki/Adding-a-custom-helper-to-Ghost
- And there's information on how to set up the Google Analytics helper specifically: https://github.com/conwid/GhostHelpers/wiki/Top
I have also written a couple of blog posts about this that could give you more info:
- Create custom helpers to add functionality to your Ghost blog
- Creating a most popular posts page with a custom ghost helper to download Google Analytics data
And finally you can check out the end results of using the helper on my blog: https://dotnetfalcon.com/greatest-hits/
(Sorry for the shameless self-marketing, but as I said, I found almost zero info about this also everywhere else).
来源:https://stackoverflow.com/questions/52102641/get-the-most-viewed-posts-in-ghost-blog