Skip to content

Commit ab26d7a

Browse files
authored
Merge pull request #2 from betagouv/trecouvr/matomo-initial-setup
Setup Matomo
2 parents 632d38d + d94245f commit ab26d7a

6 files changed

Lines changed: 23 additions & 2 deletions

File tree

docia/context_processors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ def settings(request):
66
"settings": {
77
"PROCONNECT_ALLOWED": dj_settings.PROCONNECT_ALLOWED,
88
"TCHAP_SUPPORT_CANAL_URL": dj_settings.TCHAP_SUPPORT_CANAL_URL,
9+
"MATOMO_URL": dj_settings.MATOMO_URL,
910
}
1011
}

docia/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,6 @@
333333
"TEST_REQUEST_DEFAULT_FORMAT": "json",
334334
"NON_FIELD_ERRORS_KEY": "non_field_errors",
335335
}
336+
337+
338+
MATOMO_URL = config.str("MATOMO_URL", default="")

docia/templates/docia/auth/login.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "dsfr/base.html" %}
1+
{% extends "docia/base.html" %}
22

33

44
{% block header %}

docia/templates/docia/base.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44
<title>Dépenses Éclairées</title>
55
{% endblock %}
66

7+
{% block opengraph %}
8+
{% if settings.MATOMO_URL %}
9+
<!-- Matomo Tag Manager -->
10+
<script>
11+
var _mtm = window._mtm = window._mtm || [];
12+
_mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});
13+
(function() {
14+
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
15+
g.async=true; g.src='{{ settings.MATOMO_URL }}'; s.parentNode.insertBefore(g,s);
16+
})();
17+
</script>
18+
<!-- End Matomo Tag Manager -->
19+
{% endif %}
20+
{% endblock opengraph %}
21+
722
{% block header %}
823
{% include "docia/blocks/header.html" %}
924
{% endblock header %}

example.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@ SMTP_USERNAME=
3737
SMTP_PASSWORD=
3838

3939
TCHAP_SUPPORT_CANAL=
40+
41+
MATOMO_URL=

static/js/clipboard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ document.addEventListener('DOMContentLoaded', function() {
3434
// Create the copy button
3535
const copyButton = document.createElement('button');
3636
copyButton.textContent = 'Copier';
37-
copyButton.className = 'fr-badge fr-badge--sm fr-ml-1w';
37+
copyButton.className = 'btn-copy fr-badge fr-badge--sm fr-ml-1w copy-' + fieldName;
3838
copyButton.style.fontSize = '12px';
3939
copyButton.style.padding = '2px 6px';
4040

0 commit comments

Comments
 (0)