littlelink-server/docs/analytics.md
Krzysztof Durek 2440d47294
fix: umami tracking (#603)
* fix: umami tracking

* fix: umami tracking test
2024-04-16 22:07:07 +00:00

1.4 KiB

📈 Analytics Support

Google Analytics

See Getting Started with Analytics. After getting your GA Tracking Id, use your tracking Id as environment variable like GA_TRACKING_ID=G-XXXXXXXXXX (See the example below)

All buttons clicked will be tracked automatically if GA_TRACKING_ID exists.

Sample event for YouTube button.

  window.gtag('event', 'youtube-button');

Umami

See Adding a website & Collecting data page to add and generate your tracking code.

Generated tracking code should look like:

<script async defer data-website-id="00000000-1111-2222-3333-444444444444" src="https://your-umami-app.com/umami.js"></script>

Use data-website-id as environment variable UMAMI_WEBSITE_ID. Take the inital root host of src as UMAMI_APP_URL, and the name of the script (i.e. umami.js or script.js) as UMAMI_SCRIPT_NAME.

Sample event for YouTube button.

  window.umami.track('youtube-button');

Matomo

See Installing Matomo fo how to configure analytics and how to find your site id

Use MATOMO_URL for your URL and MATOMO_SITE_ID for your site id

Sample event for YouTube button.

  window._paq.push(['trackEvent', 'youtube-button']]);