Pro Modules


The BoltWire accelerator platform has a built in activity tracking system you can use to see what's happening on your site, and even track trends. Use this information to try and improve various metrics on your site.

The activity function comes with three basic modes: a mode for logging activity, a mode for finding (and reporting) activity, and a mode for indexing site stats to better analyze trends. There is also a matching "cronactivity" function in the cron module which allows you to index activity stats so you can more easily analyze trends. Here's how it all works.

Logging Activity

To log an event on your site simply put the following code on a page:

<(activity log note='Somebody just did something.')>

Every time someone loads that page, an entry will be made on an activity log ( By default, the member id of the user will also be attached to the log. But you can also do something like this to make the note more useful:

<(activity log note='[[~{id}]] just did something.')>

To make your logs even more effective, you can attach a type to a log entry. This allows you to track trends of that particular activity type over time. Let's say for example you wanted to track logins. You could do this:

<(activity log note='[[~{id}]] just logged in.' type=login)>

While you can search these logs for the phrase "logged in", setting a type tells BoltWire you want to start indexing stats for this activity type to help you analyze trends on your site. That all happens automatically, but only if you set a type parameter.

Note: you can also use an activity command rather than a function to track specific events. If you wanted to use the login form to track logins, for example, you could just add this command:

[command activity log note='[[~{id}]] just logged in.' type=login]

Let's take a slightly more complicated example. Suppose you wanted to track views of who reads a blog article, you could add an entry like this in your blog footer:

<(activity log note='[[~{id}]] just read your blog page [[{p}|+]].' type=blog )>

This would track every person who viewed your blog. But if you have a public blog, you might have people who are not logged in reading your blog--in which case the {id} variable will not be available. So let's tweak that part just a bit:

<(activity log note='[if login][[~{id}]][else]A guest[if] just read your blog page [[{p}|+]].' type=blog)>

This would track every person visiting your blog, and which article they read. It would also record your overall blog readership, because every note will be tagged as an activity of "blog" type. In other words, you could see which articles a specific person read, which members read a specific article, how many guests read your articles, or the total number of blog articles read on your site (viewed).

You can set up your activity tracking system any way you want to capture just the information you most want to analyze. There are also many ways to generate reports, which we'll discuss in the next section.

Finding Activity

The find mode allows you to search and generate various reports from your activity logs. To generate the simplest report, of all recent activity, use the following code:

<(activity find)>

By default, the find function is limited to the most recent 50 "notes", and it will only search back a maximum of 30 days. But you can increase those numbers by setting higher values for a "count" or "days" parameter. Or setting those to false.

There are also various ways to refine your activity reports:

  • Set an id parameter to search for activity by one individual.
  • Set a group parameter to search for the combined activity of all members of a group (can by a regular group or a dynamic group).
  • Set a date parameter to retrieve activity for a specific day.
  • Set a type parameter to retrieve all activity of a specific type.
  • Set a note parameter to return all notes that contain that specific string.

Note that these parameters can be combined, to give you even more granular reports.

Let's take our blog example above. If I wanted to see what articles a person has read recently, I could use this code. I could set days=false and count=false if I wanted to search more than the last 30 days, and allow more than 50 matches.

<(activity find id=0001 type=blog)>

Let's say I wanted to see who has read a specific blog post in the last 10 days. I could use this code:

<(activity find note=blog.some-article days=10)>

Or if I wanted to see how many people in a given group read any blog post yesterday, I could use:

<(activity find date='Yesterday' type=blog group=chessclub)>

To make extracting information from your activity logs easier, we've setup a section of the Site Admin area with various report options you are welcome to explore. Feel free to add additional custom reports with more specific search criteria if desired. Note also, that your activity logs are standard info pages, so you can create even more complex reports using the core info function.

Now, assuming you've set a "type" for your blog reading activities, BoltWire is capable of indexing your site activity to give you a high level view of your total blog readership. We'll look at that in the next section.

Activity Stats

The stats mode allows you to easily index the previous days activity log. To do that, just put this code on a page:

<(activity cron)>

Basically this function scans an entire day's activity log and counts the number of instances of each activity type, and then stores that count on a special activity page connected to that date. Events with a "blog" type would be store on page "", for example, and over time might contain entries like the following:

2020.09.09: 45
2020.09.08: 31
2020.09.07: 23
2020.09.06: 13

From this, you could clearly see your blog readership has been increasing over the last 4 days. If you use this activity module consistently over a longer period of time, you will see trends even more clearly.

If you ever need to go back and reindex some past date, simple create a page with code like the following, with the date you wish to reindex.

<(activity cron date='September 3, 2020')>

This might be useful if there was some error in your log files for example. After fixing the error, you might wish to reindex them. Or if your cron job stopped working for some reason, you might need to reindex a few missed days.

Normally, you do not want to index the current day's activity, because the log is not complete until after midnight--though you can do it if you want partial results. Just be sure to index it again after the day is past, to update the totals.

The stats page in the activity section of your Site Admin area allows you to select any available activity types and review this data. And because these activity indexes are simple info pages, you can also generate reports for monthly and yearly totals (using the info function).

For example, this code could you the monthly total for a given month:

<(info sum when='equal {+p1}.{+p2} 2020.09')>

To automate creation of these stats, set a cron job to run cron.activity once each day, by adding a line like this to your cron master (page 'cron'). Feel free to change the hour (7) and minute (43) to whatever time you wish:

activity: daily | 07 43

Then on the cron activity, put this content:


That should be it! The best thing to do is get this started immediately before you start creating activity logs, and then just let it run quietly in the background.