• Resolved neilsavage

    (@neilsavage)


    I am using this shortcode to try to show pageviews from a username:

    [slimstat f='count-all' w='ip'][/slimstat]

    Is it possible to display the pageviews by a specific username? I’ve tried a number of combinations using the shortcode parameters, but I cannot get one to work. I’ve also installed the addon for tracking usernames.

    Thanks

    https://ww.wp.xz.cn/plugins/wp-slimstat/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Jason Crouse

    (@coolmann)

    Hi,

    you need to add the filter to the shortcode:

    [slimstat f=’count-all’ w=’ip’]username equals myusername[/slimstat]

    Also, note that your shortcode is counting by IP, not by ID. Is that what you want? Pageviews can be counted using the dimension ‘id’:

    [slimstat f=’count-all’ w=’id’]username equals myusername[/slimstat]

    Cheers,
    Camu

    Thread Starter neilsavage

    (@neilsavage)

    Thank you!

    ID is what I wanted. Now where it says

    username equals myusername

    How would I go about getting the username of the user that is currently logged in and viewing the page?

    Plugin Contributor Jason Crouse

    (@coolmann)

    You could specify a filter that says

    username is_not_empty 0

    Thread Starter neilsavage

    (@neilsavage)

    Thanks,

    Im getting a different number then before, but when I tried logging into different accounts, the number stay around the same and wasn’t mirroring the username pageviews in the admin panel.

    Plugin Contributor Jason Crouse

    (@coolmann)

    Are you using any browser extensions that might be blocking the tracker? Like AdBlock and friends?

    Thread Starter neilsavage

    (@neilsavage)

    Yes I am using adblock chrome extension. I’ve also tried it in incognito mode and other browsers with that disabled. I was able to get the correct result using a php in post plugin and then calling the user’s username using php like so:

    [insert_php] global $current_user;
          get_currentuserinfo();
    [/insert_php]
    
    Pageviews this month: [slimstat f='count' w='id']username equals [insert_php]echo $current_user->user_login;[/insert_php][/slimstat]
    Plugin Contributor Jason Crouse

    (@coolmann)

    There you go.

    Thread Starter neilsavage

    (@neilsavage)

    Thanks for your help!

    Plugin Contributor Jason Crouse

    (@coolmann)

    A review for Slimstat would be a nice way to say thank you.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Shortcode for Username Views not working’ is closed to new replies.