Include a particular group only in Stats

Permalink Browser Info Environment
I wanted to track logged in users visits to a particular section of a website & Tony was great with providing me instructions on how to do it. Thought I would post up the scenario & instructions here as they may be of use to someone else.

Currently the stats package by default allows you to exclude users from a certain group, but not only include users from a certain group.

It can be configured to do this with a little bit of work.

If you go to the dashboard -> systems & settings -> tracking codes
interface, then you should see where that traffic & stats script is being included on the page. It'll look something like this:
<!--STATS JS START--><script
src="/index.php/tools/packages/tony_stats/services/?mode=tracker_js"
type="text/javascript"></script><!--STATS JS END-->


If you remove it from there, you can add it directly to your theme's footer wrapped in a PHP conditional statement, checking for the group you want to only include stats from.
My code below:
<?php $u = new User(); // instantiates a user object for the currently logged in user
if ($u->isRegistered()) {
// <!--STATS JS START-->
 echo('<script src="/index.php/tools/packages/tony_stats/services/?mode=tracker_js" type="text/javascript"></script>');
// <!--STATS JS END-->
}
?>

Type: Discussion
Status: Archived
PassionForCreative
View Replies:
Tony replied on at Permalink Reply
Tony
thanks for sharing that. maybe some other developers will find it useful.
ConcreteCMS replied on at Permalink Reply
ConcreteCMS
Attention: Since there has been no activity on this issue for two weeks, this issue has been automatically archived.

To re-open this issue, reply to this message.

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.