Added Matomo analytics configuration options

This commit is contained in:
Chris Kankiewicz
2020-05-17 22:26:02 -07:00
parent 62dafbdc01
commit e0622148be
5 changed files with 37 additions and 1 deletions

View File

@@ -8,6 +8,9 @@ ZIP_DOWNLOADS=true
GOOGLE_ANALYTICS_ID=false
MATOMO_ANALYTICS_URL=false
MATOMO_ANALYTICS_ID=false
SORT_ORDER=type
REVERSE_SORT=false

View File

@@ -60,6 +60,20 @@ return [
*/
'google_analytics_id' => Helpers::env('GOOGLE_ANALYTICS_ID', false),
/**
* Your Matomo analytics URL.
*
* Default value: false
*/
'matomo_analytics_url' => Helpers::env('MATOMO_ANALYTICS_URL', false),
/**
* Your Matomo analytics site ID.
*
* Default value: false
*/
'matomo_analytics_site_id' => Helpers::env('MATOMO_ANALYTICS_SITE_ID', false),
/**
* Sorting order of files and folders.
*

View File

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

View File

@@ -7,7 +7,11 @@
<link rel="stylesheet" href="{{ asset('app.css') }}">
{% if config('google_analytics_id', false) %}
{% include 'components/google-analytics.twig' %}
{% include 'components/analytics/google.twig' %}
{% endif %}
{% if config('matomo_analytics_url', false) and config('matomo_analytics_site_id', false) %}
{% include 'components/analytics/matomo.twig' %}
{% endif %}
<title>{{ title }} &bull; Directory Lister</title>