Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajout code tracking Matomo #6

Merged
merged 2 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
# transport-normes-site
Ce repo est le code Hugo permettant de déployer le contenu de https://github.com/etalab/transport-normes en tant que site internet.

Le site est déployé sur https://normes.transport.data.gouv.fr/.
Le site est déployé sur https://normes.transport.data.gouv.fr


## Développement local

En local, après [avoir installé Hugo](https://gohugo.io/installation/), exécuter les commandes suivantes

```sh
git submodule update --init --recursive
hugo server
```

## Commande de déploiement

La commande utilisée pour déployer le site sur Netlify est la suivante :

`git submodule update --init --remote content/posts && hugo --minify`
`git submodule update --init --remote content/normes && hugo --minify`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


On initialise uniquement le submodule souhaité (le contenu des normes, pas le thème Hugo !), en passant l'option `--remote` pour aller lire la dernière version sur le repo en question.

Un commit sur la branche principale de https://github.com/etalab/transport-normes déclenche un redéploiement du site via une Github Action sur le repo du contenu (via une requête POST sur Netlify).
Un commit sur la branche principale de https://github.com/etalab/transport-normes déclenche un redéploiement du site via [une Github Action](https://github.com/etalab/transport-normes/blob/main/.github/workflows/github-actions.yml) sur le repo du contenu (via une requête POST sur Netlify).
5 changes: 4 additions & 1 deletion layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@

</script>
{{- end }}

{{ partial "matomo.html" . }}

<noscript>
<style type="text/css">
#theme-toggle,
Expand Down Expand Up @@ -149,4 +152,4 @@
{{- end }}
</ul>
</nav>
</header>
</header>
16 changes: 16 additions & 0 deletions layouts/partials/matomo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- /* Matomo tracking code */}}
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["setCookieDomain", "*.transport.data.gouv.fr"]);
_paq.push(["setDomains", "*.transport.data.gouv.fr"]);
thbar marked this conversation as resolved.
Show resolved Hide resolved
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function() {
var u="//stats.data.gouv.fr/";
_paq.push(["setTrackerUrl", u+"matomo.php"]);
_paq.push(["setSiteId", "58"]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName("script")[0];
g.type="text/javascript"; g.async=true; g.defer=true; g.src=u+"matomo.js"; s.parentNode.insertBefore(g,s);
})();
</script>
{{- /* end Matomo tracking code */}}