Added matomo analytics

This commit is contained in:
Samuel Ortion 2021-04-01 08:57:34 +02:00
parent 94e02e6c68
commit 29bd20b42b
21 changed files with 136 additions and 8 deletions

15
analytics/matomo.php Normal file
View File

@ -0,0 +1,15 @@
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//analytics.ortion.xyz/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '4']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->

View File

@ -16,6 +16,9 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
<title>About | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>

View File

@ -10,6 +10,9 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
<title>API v1 Documentation | Chiro - Canto</title>
<link rel="stylesheet" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php
include("$root/menu.php");

View File

@ -0,0 +1,6 @@
# Queries | Chiro-Canto API v1
## /api/v1/species
Retrieve informations on species present in Chiro-Canto database
### Method: GET
### Results: JSON

View File

@ -0,0 +1,6 @@
# Documentation Chiro-Canto API v1
## About
This API aims to be a complete RESTful API, with full access to all functionnality of Chiro-Canto.

View File

@ -16,6 +16,9 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
<title>Login | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>

View File

@ -16,6 +16,9 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
<title>Register | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>

View File

@ -10,6 +10,9 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
<title>Contact | Chiro-Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php"); ?>
<?php include("$root/header.php"); ?>

View File

@ -30,6 +30,9 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
<title>Explore | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>

View File

@ -0,0 +1,53 @@
<?php
session_reset();
session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
require "$root/database/credentials.php";
// Connect the database
try {
$db = new PDO("mysql:host=$host;dbname=$database;charset=utf8",
$user,
$password,
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
));
} catch (Exception $e) {
die("Error : ".$e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Explore | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>
<section>
<h3>Explore</h3>
<h4>Record Map</h4>
<div id="map"></div>
</section>
<?php include("$root/footer.php");?>
<script src="/scripts/script.js"></script>
<script src='/scripts/jquery/script.js'></script>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
<script src="scripts/map.js"></script>
</body>
</html>

View File

@ -0,0 +1,9 @@
var mymap = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
maxZoom: 18,
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1,
accessToken: 'pk.eyJ1IjoidW5jbGVzYW11bHVzIiwiYSI6ImNrbXVmanF1bzEwd2Mybm82Nzlobm42bHAifQ.fKY7fUnY-MpzZUcseao0zg'
}).addTo(mymap);

View File

@ -30,6 +30,9 @@ $result = $req->fetchAll();
<title>Explore | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>

View File

@ -22,7 +22,7 @@ $req->execute();
if ($data = $req->fetch())
{
?>
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
@ -31,6 +31,9 @@ if ($data = $req->fetch())
<title>Explore | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>

View File

@ -30,6 +30,9 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
<title>Explore | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>

View File

@ -36,6 +36,9 @@ $data = $req->fetch();
<title>Explore | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>

View File

@ -16,6 +16,9 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
<title>Forum | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>

View File

@ -16,6 +16,9 @@ $root = realpath($_SERVER["DOCUMENT_ROOT"]);
<title>Forum | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>

View File

@ -13,9 +13,9 @@
height="750"
viewBox="0 0 750 750"
sodipodi:docname="chiro.svg"
inkscape:export-filename="/var/www/chiro-canto/public/media/pictures/favicon.png"
inkscape:export-xdpi="4.0960002"
inkscape:export-ydpi="4.0960002"
inkscape:export-filename="/var/www/chiro-canto/public/media/pictures/icone.png"
inkscape:export-xdpi="64"
inkscape:export-ydpi="64"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<metadata
id="metadata905">
@ -39,7 +39,7 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="960"
inkscape:window-width="1920"
inkscape:window-height="1011"
id="namedview901"
showgrid="false"
@ -48,7 +48,7 @@
inkscape:cy="873.89687"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="0"
inkscape:window-maximized="1"
inkscape:current-layer="g907"
inkscape:document-rotation="0" />
<g

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -24,7 +24,7 @@
</a>
</ul>
<div>
<?=isset($_SESSION['username']) ? "Welcome ".$_SESSION['username']. " !" : '<a href="/auth/login">sign in</a> <a href=/auth/register">sign up</a>'?>
<?=isset($_SESSION['username']) ? "Welcome ".$_SESSION['username']. " !" : '<a href="/auth/login">sign in</a> <a href="/auth/register">sign up</a>'?>
</div>
</div>
</nav>

File diff suppressed because one or more lines are too long

View File

@ -68,6 +68,9 @@ if (empty($result))
<title>Explore | Chiro - Canto</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<?php
include("$root/analytics/matomo.php");
?>
<body>
<?php include("$root/menu.php");?>
<?php include("$root/header.php");?>