No, it’s not currently possible to display the analytics on the front-end. However, you can share back-end analytics access with non-admins and hide the WP admin interface.
Sharing back-end access
You can follow this tutorial to learn how to share access with other user roles on your site. You can also limit their access to stats for their own content only.
If you give the Subscriber role access, they will only be able to see a simplified Dashboard menu, the Profile menu, and the Analytics menu. You can also create a new custom user role with the User Role Editor plugin if you want.
Hiding the WP menu
If you want to hide the fact that they’re inside the WP admin, you can use the following code to hide the sidebar completely.
function hide_admin_sidebar_for_subscribers() {
if (current_user_can('subscriber')) {
echo '<style>
#adminmenumain, #adminmenuwrap, #wpadminbar, #adminmenu {
display: none !important;
}
#wpcontent, #wpbody {
margin-left: 0 !important;
}
</style>';
}
}
add_action('admin_head', 'hide_admin_sidebar_for_subscribers');
This code hides the WP admin sidebar if the user has the Subscriber user role.
Lastly, you can automatically redirect them to the Analytics menu when they login with this code snippet:
function redirect_subscribers_after_login($redirect_to, $request, $user) {
// Check if user is a valid WP_User object and has the 'subscriber' role
if (isset($user->roles) && is_array($user->roles) && in_array('subscriber', $user->roles)) {
return admin_url('profile.php'); // or use a custom URL here
}
return $redirect_to;
}
add_filter('login_redirect', 'redirect_subscribers_after_login', 10, 3);
Again, this will target anyone with the Subscriber user role who logs into the site. They’ll be automatically redirected to the Analytics menu, and with the sidebar hidden, they won’t see any other menus to navigate to.
You can add both snippets to your site using the free Code Snippets plugin.
If you have a dedicated account page on the front-end of your site for members, you can add an Analytics link and have it open in a new tab instead of redirecting members when they login.
