Skip to content

Using Analytics Shortcodes

Pro. This feature requires WB Member Blog Pro. The free plugin must be installed and active first. See the Pro index for every Pro module.

Display analytics data anywhere on your site using shortcodes. Site owners can use these to create custom analytics dashboards or author leaderboards.

What You’ll Learn

Available analytics shortcodes Shortcode attributes and options Where to place shortcodes Example use cases

Main Analytics Shortcode

[bp-member-blog-analytics]

Displays the full analytics dashboard for the current logged-in user.

Attributes

AttributeDefaultDescriptionuser_idCurrent userShow analytics for a specific userdays30Number of days to displayshow_chartyesDisplay the views chartshow_sourcesyesDisplay traffic sourcesshow_top_postsyesDisplay top posts list

Examples

Basic usage - show current user’s analytics:

[bp-member-blog-analytics]

Show last 7 days only:

[bp-member-blog-analytics days=“7”]

Show specific user’s analytics (by user ID):

[bp-member-blog-analytics user_id=“5”]

Chart only, no lists:

[bp-member-blog-analytics show_sources=“no” show_top_posts=“no”]

Post Views Counter Shortcode

[bp-member-blog-views]

Displays view count for a specific post. Use inside post content or templates.

Attributes

AttributeDefaultDescriptionpost_idCurrent postShow views for a specific postformatnumberDisplay format: number, text, or iconlabel(empty)Text to show before the count

Examples

Show views for current post:

[bp-member-blog-views]

With a label:

[bp-member-blog-views label=“Views: “]

Text format (includes “views” word):

[bp-member-blog-views format=“text”]

Output: “1,234 views”

Specific post:

[bp-member-blog-views post_id=“123”]

Author Stats Shortcode

[bp-member-blog-author-stats]

Displays summary statistics for an author.

Attributes

AttributeDefaultDescriptionuser_idCurrent userShow stats for specific usershow_postsyesShow total post countshow_viewsyesShow total viewsshow_avgyesShow average views per postlayoutinlineDisplay layout: inline, grid, or vertical

Examples

Basic author stats:

[bp-member-blog-author-stats]

Grid layout with all stats:

[bp-member-blog-author-stats layout=“grid”]

Views only:

[bp-member-blog-author-stats show_posts=“no” show_avg=“no”]

Top Authors Leaderboard

[bp-member-blog-top-authors]

Displays a leaderboard of top authors by views or post count.

Attributes

AttributeDefaultDescriptioncount10Number of authors to showorderbyviewsSort by: views, posts, or averagedays30Time period to considershow_avataryesDisplay author avatarsshow_statsyesShow view/post counts

Examples

Top 5 authors this month:

[bp-member-blog-top-authors count=“5” days=“30”]

Most prolific authors (by post count):

[bp-member-blog-top-authors orderby=“posts”]

All-time top authors:

[bp-member-blog-top-authors days=“0”]

Where to Use Shortcodes

On Pages

Create a dedicated analytics or leaderboard page:

Create a new page Add the shortcode to the content Publish the page

In Widgets

Add to sidebars or widget areas:

Go to Appearance → Widgets Add a Text or Custom HTML widget Paste the shortcode Save

In Theme Templates

Use PHP to output shortcodes in templates:

<?php echo do_shortcode(‘[bp-member-blog-views]’); ?>

Example Use Cases

Author Profile Page

Show author stats on their profile:

<h3>My Stats</h3> [bp-member-blog-author-stats layout=“grid”]

<h3>My Top Posts</h3> [bp-member-blog-analytics show_chart=“no” show_sources=“no”]

Community Leaderboard Page

<h2>Top Authors This Month</h2> [bp-member-blog-top-authors count=“10” days=“30”]

<h2>All-Time Leaders</h2> [bp-member-blog-top-authors count=“5” days=“0”]

Sidebar Widget

<h4>Top Contributors</h4> [bp-member-blog-top-authors count=“5” show_stats=“no”]

Styling Shortcode Output

All shortcodes output elements with CSS classes for customization:

/* Analytics container */ .bp-member-blog-analytics { }

/* Views counter */ .bp-member-blog-views { }

/* Author stats */ .bp-member-blog-author-stats { }

/* Top authors list */ .bp-member-blog-top-authors { } .bp-member-blog-author-item { }

Related Docs

How to Navigate Your Author Dashboard Understanding Your Post Analytics All Shortcodes Reference (Free Plugin)

]]>