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

Show Analytics for posts #148

Closed
ThomasTr opened this issue Jul 16, 2023 · 4 comments
Closed

Show Analytics for posts #148

ThomasTr opened this issue Jul 16, 2023 · 4 comments

Comments

@ThomasTr
Copy link

It would be nice to show analytics for each post from backend posts page. Either as a link to plausible installation, or as a async loading overlay or as page within wordpress backend.

Actually the way is to copy the uri and filter for it in plausible.

oliveratgithub added a commit to oliveratgithub/plausible-api-wordpress that referenced this issue Jul 17, 2023
@oliveratgithub
Copy link

I really like the idea! 💯

Extended my WP Plausible API proof-of-concept with a Demo of such a Plug-in 😎
https://github.com/oliveratgithub/plausible-api-wordpress#post-and-page-insights

Plausible Analytics WP - Post and Page Analytics preview

@ThomasTr
Copy link
Author

Hi @oliveratgithubm looks nice 👍
For me the aproach in the posts list fits better, so i don't have to navigate in each post.
I wrote the following in my funtions.php last night as a quick hack with hardcoded uri's:

add_filter( 'post_row_actions', 'add_analytics_link', 10, 2 );

function add_analytics_link( $actions, $post )
{
    $actions['analytics'] = '<a href="https://__MY_ANALYTICS__URI/__MY_SITE__?period=30d&page=' . urlencode('/'.$post->post_name) . '" target="_blank">Analytics</a>';

    return $actions;
}

Which results in the following link below each posting when you hover over it:

Screenshot

Of course, you could change this to an overlay that loads the data via Javascript so that you don't have to leave the page.
But for a first hack without spending much time, that's enough for me for now.

@Dan0sz
Copy link
Collaborator

Dan0sz commented Jul 19, 2023

This is really cool, guys! Thanks for the work!

@metmarkosaric should we put this on the roadmap?

@metmarkosaric
Copy link
Collaborator

yeah i think we could add this in the future. the "Disable menu in toolbar" section of the plugin settings could be changed to include this as an option too. should not be on by default i think as it might make things too noisy for some people

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants