Integration with analytics.ifg.io
The astro skeleton includes integration with analytics.ifg.io and and a GDPR conforming opt-out component. (via @ifg/libconsent and @ifg/astro-utils) To set this up for a project there are some very simple steps that need to be taken.
Required setup
- Provision the project with matomo enabled in the ansible project definition
(
/vars/ifg_projects/example-project.yml) - When the project is deployed to prod the next time the tracking should work automatically.
👷 In case you’re interested: the ansible script write the matomo site ID into a gitlab ci variable which is used by the matomo integration of
@ifg/astro-utilsin the astro configuration file to inject the tracking script.
Setting up opt-out
The opt-out component is provided by @ifg/libconsent as a custom web
component and as a svelte component. Unless you are using svelte in your astro
project, you want to use the custom component. An example:
<Layout title="Privacy policy">
<!-- ... -->
<matomo-consent-widget></matomo-consent-widget>
<!-- ... -->
</Layout>
<script>
import "@ifg/libconsent/matomoConsentWidget.customElement";
</script>
ℹ️ You can use the component in MDX/MD as well (html is valid markdown) as long as the import happens somewhere on the page (f.x in the wrapping Layout.astro)