You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Matomo (formerly Piwik) is arguably the most well-established open-source alternative to Google Analytics. There's a package which allows for an easy use of Matomo with NextJS projects:
I couldn't integrate this into the app/layout.tsx because you can't use client-side "useEffect" in the server-side files. Perhaps there's an easy way to solve this, but my understanding of NextJS is somewhat limited.
The text was updated successfully, but these errors were encountered:
<!--Matomo--><script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {varu="//domain.com/";_paq.push(['setTrackerUrl',u+'matomo.php']);_paq.push(['setSiteId','1']);vard=document,g=d.createElement('script'),s=d.getElementsByTagName('script')[0];g.async=true;g.src=u+'matomo.js';s.parentNode.insertBefore(g,s);})();
</script><!--EndMatomoCode-->
Would MatomoAnalytics.tsx in pliny look like this?
Matomo (formerly Piwik) is arguably the most well-established open-source alternative to Google Analytics. There's a package which allows for an easy use of Matomo with NextJS projects:
https://www.npmjs.com/package/@socialgouv/matomo-next
I use it in my other NextJS projects by creating the following component:
And importing it in
_app.js
as:I couldn't integrate this into the
app/layout.tsx
because you can't use client-side "useEffect" in the server-side files. Perhaps there's an easy way to solve this, but my understanding of NextJS is somewhat limited.The text was updated successfully, but these errors were encountered: