Understanding Visits and Action levels in Matomo
As you become familiar with Matomo, you’ll encounter the concepts of Visits and Actions levels (or scopes) several times. Understanding these levels is an essential part of your learning curve to mastering Matomo.
You probably came across these two levels when first learning about Custom Dimensions but fully grasping the concept may take some time.
A great way to begin learning about Visits and Actions is by exploring how Matomo stores data. To do this, use the Module Live API reporting within our Demo.
Start by calling the Live.getLastVisitsDetails method found in the Demo setting the day to 2024-09-29, and you will see something like this:
You’ll observe details of visit ID 13270379 for Demo site ID 1 on 29 August 2024. The data returned is in JSON format, though it can also be exported in XML or CSV (TSV) formats. To read the JSON properly, ensure the “Pretty print” option in the top left corner of your browser is enabled.
The structure of the JSON response contains two levels: the visit level and the action level, which starts with “actionDetails”.
At the action level, you’ll find entries like “url”: “https://divezone.net/liveaboard/french-polynesia-master”, showing the page URL, which is a common name-value pair at this level.
Further down, at the visit level, you’ll see entries like “visitorType”: “returning”, “deviceType”: “Desktop”, “totalEcommerceRevenue”: 0. It’s useful to become familiar with which key-value pairs belong to the visit or action level:
In the second visit (“idVisit”: 13270294), you’ll observe a variety of actions:
This visit includes multiple page views, outlinks, an event, and an e-commerce entry. Looking closely at the e-commerce entry, the “type”: “ecommerceAbandonedCart” indicates that an item was left in the cart, valued at 89. The visitor came from Facebook, and the “itemDetails” show specifics of the abandoned cart item:
If you search for “type”: “ecommerceAbandonedCart” in the JSON file, you’ll find several e-commerce data entries, each tracking items. For example:
Exploring further, you’ll notice several useful entries at the action level, such as the “type” key, which indicates the action type at this level:
The type key can have many values:
- action
- outlink
- goal
- ecommerceAbandonedCart
- crash
- event
- ecommerceOrder
- form
- media
It’s important to note that “type”: “action” can also contain e-commerce data, as seen below. The productViewName and productViewSKU refer to the product details viewed on the page:
Understanding Visit and Action levels is a powerful way to audit your tracking data and identify inconsistencies. The Module Live is a valuable tool for this, especially when combined with segmentation to filter specific data for deeper analysis.