Data Whimsy
  • Home
  • What is Matomo
  • Contact
  • Custom Reports
  • Connect Matomo to other software
  • CLI API etc
  • Matomo Tag Manager Simple Guide
  • Lyn Only
  • Troubleshooting + Deploying Matomo
  • Weird Data
  • Why is data in Matomo giving different numbers than Google Analytics
  • The Dashboard
  • Moving the Data
  • Book Club Forum

Without the dashboard

The top slot of your browser can send requests to Tracking API & Reporting API
The command line of your browser can accept direct Matomo input (e.g. the PHP ./console command).
On this page are a variety of things you can do without ever touching the visual dashboard (Matomo GUI)

Under the hood with: Matomo's Javascript

11/2/2023

0 Comments

 
Goal:
Pedagogically poke around: get to know how Matomo attaches Javascript to your website.

Method:
We will just "mess around".

Warmup:
Open a web page which is running Matomo Javascript Tracker.

Feel free to open your own website. Or you could load your browser with a public website that uses Matomo's Javascript tracker.  At the time of this writing, this includes, westerndigital.com, bundesliga.de, oebb.at, msufcu.org, telummedia.com, bcferries.com, and 1.6% of the internet.**

Lesson 1:
Open any website which has javascript from Matomo already (see above).
Open the browser dev tools >> console (I am using Firefox devtools, so adapt if you're on Chrome/Safari/Brave/Arc browser)
In Console type _paq
You are now seeing the Piwik object. Objects are JS data structures, similar to arrays but they can nest. And instead of just storing strings and numbers, they can store executable code. Notice that most of the _paq object is functions.  This _paq is named for Piwik still, from when that was Matomo's old name. (There is a history link at the base of Matomo's home page if you are curious.)

Do not try to store values in _paq. It is intended to be a place to run commands, as in _paq.push();

Lesson 2:
You can see all available methods by entering this in the browser console... window.Matomo.getAsyncTrackers()[0]

Optional Reading: https://developer.matomo.org/guides/tracking-javascript-guide
Optional Reading: https://developer.matomo.org/api-reference/tracking-javascript

**Some web pages use Matomo without JS. (Turns out that Javascript is just one of the four ways to track visitors at a website, but JS is the most common, by far.) And in some cases there will be no Matomo code unless you click Yes on a consent banner.
0 Comments



Leave a Reply.

    Author

    Evan Genest

    Archives

    November 2024
    August 2024
    May 2024
    March 2024
    February 2024
    November 2023
    October 2023
    September 2023
    August 2023

    Categories

    All

Powered by Create your own unique website with customizable templates.
  • Home
  • What is Matomo
  • Contact
  • Custom Reports
  • Connect Matomo to other software
  • CLI API etc
  • Matomo Tag Manager Simple Guide
  • Lyn Only
  • Troubleshooting + Deploying Matomo
  • Weird Data
  • Why is data in Matomo giving different numbers than Google Analytics
  • The Dashboard
  • Moving the Data
  • Book Club Forum