Click / Mouse movements data available via Reporting API?

Dear Matomo Team. dear fellow Matomo users!

we use Matomo along with the A/B-Testing Feature and contemplate buy/using the Heatmap/Session Recording Feature.
We want to use the Click and Mouse movement data for Machine Learning purposes. So we were wondering how the data is recorded and whether and in what form it is available using the Reporting API.

Thank you!

Kind regards
Frank
(Data Scientist at Hamburg Open Online University; hoou.de)

Hi,

All data that is recorded in Matomo can be accessed via the API, so you can get the full raw data of every recorded session and every heatmap

You can find the API documentation here:
https://demo.matomo.org/index.php?module=API&action=listAllAPI&idSite=62&period=day&date=yesterday

If you e.g. want to get the heatmap you can see here as raw data you can request the following API endpoint:
https://demo.matomo.org/index.php?date=2018-04-07,2019-01-11&deviceType=1&filter_limit=-1&format=JSON2&heatmapType=2&idSite=62&idSiteHsr=11&method=HeatmapSessionRecording.getRecordedHeatmap&module=API&period=range

As you probably want to use the exact data for machine learning, you are maybe also interested in accessing the raw recorded sessions. The HeatmapSessionRecording.getRecordedSession endpoint will then return something like this.

Click to open
{
  "url": "localhost/matomotests/hsr.html",
  "idvisit": "1",
  "idvisitor": "dd41146b77604ea4",
  "idsite": "1",
  "location_country": "at",
  "location_region": "9",
  "location_city": "Vienna",
  "config_os": "LIN",
  "config_device_type": "0",
  "config_device_model": "generic desktop",
  "config_browser_name": "FF",
  "time_on_page": "23358",
  "server_time": "2019-01-10 12:54:21",
  "viewport_w_px": "739",
  "viewport_h_px": "977",
  "scroll_y_max_relative": "1000",
  "fold_y_relative": "1000",
  "browser_name": "Firefox",
  "browser_logo": "plugins/Morpheus/icons/dist/browsers/FF.png",
  "os_name": "GNU/Linux",
  "os_logo": "plugins/Morpheus/icons/dist/os/LIN.png",
  "device_name": "Desktop, generic desktop",
  "device_logo": "plugins/Morpheus/icons/dist/devices/desktop.png",
  "location_name": "Österreich, unbekannt, Vienna",
  "location_logo": "plugins/Morpheus/icons/dist/flags/at.png",
  "server_time_pretty": "10.1.2019 13:54:21",
  "time_on_page_pretty": "23 s",
  "events": [
    {
      "time_since_load": "0",
      "event_type": "1",
      "x": "1572",
      "y": "378",
      "selector": "html",
      "text": null
    },
    {
      "time_since_load": "0",
      "event_type": "5",
      "x": "0",
      "y": "0",
      "selector": null,
      "text": "{\"rootId\":1,\"children\":[{\"nodeType\":8,\"id\":2,\"textContent\":\" \"},{\"nodeType\":1,\"id\":3,\"tagName\":\"HTML\",\"attributes\":{\"data-lt-installed\":\"true\"},\"childNodes\":[{\"nodeType\":1,\"id\":4,\"tagName\":\"HEAD\",\"attributes\":{},\"childNodes\":[{\"nodeType\":1,\"id\":5,\"tagName\":\"SCRIPT\",\"attributes\":{}},{\"nodeType\":1,\"id\":6,\"tagName\":\"SCRIPT\",\"attributes\":{}},{\"nodeType\":3,\"id\":7,\"textContent\":\"\\n\"},{\"nodeType\":8,\"id\":8,\"textContent\":\" \"},{\"nodeType\":3,\"id\":9,\"textContent\":\"\\n\\n\"},{\"nodeType\":1,\"id\":10,\"tagName\":\"SCRIPT\",\"attributes\":{}}]},{\"nodeType\":1,\"id\":11,\"tagName\":\"BODY\",\"attributes\":{},\"childNodes\":[{\"nodeType\":1,\"id\":12,\"tagName\":\"H1\",\"attributes\":{},\"childNodes\":[{\"nodeType\":3,\"id\":13,\"textContent\":\"Test page\"}]},{\"nodeType\":3,\"id\":14,\"textContent\":\"\\n\\n\\n\"},{\"nodeType\":1,\"id\":15,\"tagName\":\"P\",\"attributes\":{},\"childNodes\":[{\"nodeType\":3,\"id\":16,\"textContent\":\"Lorem ipsum\"}]},{\"nodeType\":3,\"id\":17,\"textContent\":\"\\n\"}]},{\"nodeType\":1,\"id\":18,\"tagName\":\"STYLE\",\"attributes\":{\"id\":\"stylus-1\",\"type\":\"text/css\",\"class\":\"stylus\"},\"childNodes\":[{\"nodeType\":3,\"id\":19,\"textContent\":\"code,\\npre,\\n.blob-code {\\n    font-family: \\\"Fira Code Retina\\\"!important;\\n}\"}]}]}]}"
    },
    {
      "time_since_load": "1143",
      "event_type": "1",
      "x": "1530",
      "y": "362",
      "selector": "html",
      "text": null
    },
    {
      "time_since_load": "1342",
      "event_type": "1",
      "x": "1096",
      "y": "192",
      "selector": "html",
      "text": null
    },
    {
      "time_since_load": "1559",
      "event_type": "1",
      "x": "630",
      "y": "1790",
      "selector": "html > body > p",
      "text": null
    },
    {
      "time_since_load": "1592",
      "event_type": "1",
      "x": "630",
      "y": "1368",
      "selector": "html > body > p",
      "text": null
    },
    {
      "time_since_load": "1956",
      "event_type": "1",
      "x": "94",
      "y": "80",
      "selector": "html > body",
      "text": null
    },
    {
      "time_since_load": "2155",
      "event_type": "1",
      "x": "60",
      "y": "74",
      "selector": "html > body",
      "text": null
    },
    {
      "time_since_load": "2355",
      "event_type": "1",
      "x": "78",
      "y": "1166",
      "selector": "html > body > h1",
      "text": null
    },
    {
      "time_since_load": "2425",
      "event_type": "2",
      "x": "78",
      "y": "1166",
      "selector": "html > body > h1",
      "text": null
    },
    {
      "time_since_load": "3050",
      "event_type": "2",
      "x": "78",
      "y": "1166",
      "selector": "html > body > h1",
      "text": null
    },
    {
      "time_since_load": "3193",
      "event_type": "2",
      "x": "78",
      "y": "1166",
      "selector": "html > body > h1",
      "text": null
    },
    {
      "time_since_load": "3529",
      "event_type": "1",
      "x": "312",
      "y": "1222",
      "selector": "html > body > h1",
      "text": null
    },
    {
      "time_since_load": "3963",
      "event_type": "1",
      "x": "200",
      "y": "98",
      "selector": "html > body",
      "text": null
    },
    {
      "time_since_load": "4162",
      "event_type": "1",
      "x": "150",
      "y": "316",
      "selector": "html > body > p",
      "text": null
    },
[...]
    {
      "time_since_load": "20009",
      "event_type": "1",
      "x": "1406",
      "y": "350",
      "selector": "html > body",
      "text": null
    }
  ],
  "pageviews": [
    {
      "label": "localhost/matomotests/hsr.html",
      "idvisitor": "dd41146b77604ea4",
      "idloghsr": "3",
      "time_on_page": "23358",
      "resolution": "739x977",
      "server_time": "2019-01-10 12:54:21",
      "scroll_y_max_relative": "1000",
      "fold_y_relative": "1000",
      "server_time_pretty": "10.1.2019 13:54:21",
      "time_on_page_pretty": "23 s"
    }
  ],
  "numPageviews": 1
}

I hope this helps you. If you have further questions, just ask or write an email to shop@innocraft.com.