fixed matomo to be in the master twig template.
This commit is contained in:
parent
42a828a778
commit
14ec6b7e7a
@ -11,6 +11,7 @@ $config = [
|
||||
'secure_key' => '', //64 alphanumeric characters
|
||||
'logfile' => '/logs/novaconium.log',
|
||||
'loglevel' => 'ERROR', // 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'NONE',
|
||||
'matomo' => '1',
|
||||
'matomo_url' => 'matomo.4lt.ca',
|
||||
'matomo_id' => '0',
|
||||
'fonts' => 'https://fonts.googleapis.com/css2?family=VT323:wght@400&family=Fira+Code:wght@400;500&display=swap&family=Material+Icons:wght@400;500&display=swap'
|
||||
];
|
||||
|
||||
@ -17,7 +17,8 @@ $log = new Logger(\BASEPATH . $config['logfile'], $config['loglevel']);
|
||||
// --- Twig Data Array ---
|
||||
$data = [];
|
||||
$data['fonts'] = $config['fonts'] ?? [];
|
||||
$data['matomo'] = $config['matomo'] ?? 0;
|
||||
$data['matomo_url'] = $config['matomo_url'] ?? '';
|
||||
$data['matomo_id'] = $config['matomo_id'] ?? '0';
|
||||
|
||||
// --- Session ---
|
||||
use Novaconium\Session;
|
||||
|
||||
@ -1,28 +1,10 @@
|
||||
<!--
|
||||
What goes very last on the page.
|
||||
right before the /body
|
||||
like javascript
|
||||
or analytics
|
||||
such as javascript
|
||||
-->
|
||||
{% include '@novaconium/javascript/page-edit.html.twig' %}
|
||||
|
||||
{% if editor == 'ace' %}
|
||||
{% include '@novaconium/javascript/ace.html.twig' %}
|
||||
{% endif %}
|
||||
|
||||
{% if matomo > 0 %}
|
||||
<!-- Matomo -->
|
||||
<script>
|
||||
var _paq = window._paq = window._paq || [];
|
||||
_paq.push(['trackPageView']);
|
||||
_paq.push(['enableLinkTracking']);
|
||||
(function() {
|
||||
var u = "//matomo.4lt.ca/";
|
||||
_paq.push(['setTrackerUrl', u + 'matomo.php']);
|
||||
_paq.push(['setSiteId', {{ matomo }}]);
|
||||
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
|
||||
g.async = true; g.src = u + 'matomo.js'; s.parentNode.insertBefore(g, s);
|
||||
})();
|
||||
</script>
|
||||
<!-- End Matomo Code -->
|
||||
{% endif %}
|
||||
@ -60,4 +60,32 @@
|
||||
{% endif %}
|
||||
|
||||
{% include ['@override/foot.html.twig', '@novaconium/foot.html.twig'] %}
|
||||
{% if matomo_id > 0 %}
|
||||
<!-- Matomo -->
|
||||
<script>
|
||||
var _paq = window._paq = window._paq || [];
|
||||
|
||||
{% if is_404 %}
|
||||
_paq.push([
|
||||
'setDocumentTitle',
|
||||
'404 / Not Found - ' + document.location.pathname
|
||||
]);
|
||||
{% endif %}
|
||||
|
||||
_paq.push(['trackPageView']);
|
||||
_paq.push(['enableLinkTracking']);
|
||||
|
||||
(function() {
|
||||
var u = "//{{ matomo_url|trim('/') }}/";
|
||||
_paq.push(['setTrackerUrl', u + 'matomo.php']);
|
||||
_paq.push(['setSiteId', {{ matomo_id }}]);
|
||||
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
|
||||
g.async = true;
|
||||
g.src = u + 'matomo.js';
|
||||
s.parentNode.insertBefore(g, s);
|
||||
})();
|
||||
</script>
|
||||
<!-- End Matomo Code -->
|
||||
{% endif %}
|
||||
|
||||
</body></html>
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
{% set is_404 = status_code is defined and status_code == 404 %}
|
||||
{% extends '@novaconium/master.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user