Show statistics website

Hello,

I am using XIBO and it is working great. Only thing is to get enough input to show on the display. Don’t show the same layouts week after week. It get’s boring.

So, I was thinking: I am also the webmaster of a Joomla! website, and we use Matomo for statistics/analytics. Would it be possible to show the statistics directly in an layout?
Do I have to make an API-connection?
Maybe someone has done this before? I have no experience with API, so a little help would be appreciated.

Regards, Peter

Hello,

I am able to connect and get statistics via an API.
I run the API-file on my PC using xampp.
The file shows the countries and number of visits per country (just used this as example).
Now, I want to implement this on a layout.
Is it possible to embed an .php file?

regards, Peter

I use this to get my data.

<?php
// this token is used to authenticate your API request.
// You can get the token on the API page inside your Matomo interface
$token_auth = 'thisismysecrettokenkey!';

// we call the REST API and request the 100 first keywords
// for the last month for the idsite=62
$url = "https://www.mydomain.nl/statistics/";
$url .= "?module=API&method=UserCountry.getCountry";
$url .= "&idSite=1&period=week&date=today";
$url .= "&format=JSON&filter_limit=10";
$url .= "&token_auth=$token_auth";

$fetched = file_get_contents($url);
$content = json_decode($fetched,true);

// case error
if (!$content) {
print("No data found");
}

print("<h1>Countries with most visits</h1>\n");
foreach ($content as $row) {

$countryName = htmlspecialchars($row["label"], ENT_QUOTES, 'UTF-8');
$hits = $row['nb_visits'];

print("<b>$countryName</b> ($hits visits)<br>\n");
}

Now I need a way to “connect” to xibo.
Can someone help me with this?

Regards, Peter