• Extensions
  • FriendsOfFlarum Analytics - tracking user visits

EvilExecutor
HuseyinKogo

You can use Google Tag Manager to trigger a Google Analytics 4 tag and normally it should work.

FoF Analytics Settings
Add the GTM ID (you can leave the Google Analytics code empty [Tracking Code ID])

Google Tag Manager
Create a GA4 tag with the correct measurement ID.

You can follow this tutorial where it gets explained in detail:
How to Install Google Analytics 4 with Google Tag Manager

21 days later

Version 1.0.0

  • Add compatibility with Flarum 1.0+
  • Rename "Piwik" to "Matomo" in translations and documentation
  • Update Piwik javascript template code with Matomo javascript
  • Update documentation and translations to reflect the fact the Matomo page is no longer a page but a widget since beta 15

Celebrating 100 commits to fof/analytics! This extension has come a long way since 2015

    3 months later

    Hey
    In Matomo
    Its possible to run a cookieless, but you need to add a line to the script
    _paq.push(["disableCookies"]);
    Is it posible to edit the script?

      FrederikDan there is no official way to do it at this time.

      You can edit the piwik-analytics.html file in the vendor folder https://github.com/FriendsOfFlarum/analytics/blob/master/resources/js/piwik-analytics.html but there's a risk the changes will be lost every time you install or update any extension.

      A more reliable solution would be to use the Flarum frontend content extender, and loop though $document->head, find the javascript block for Matomo and perform a string modification on it.

        I encounter an error, people might be losing visits.

        If we use the normal Tracking Code ID UA-XX
        And adding the GTM code ID's

        That way it will track the first visit when you enter the url but will not track when you start navigating.

        If you use GTM code ID's alone, without Tracking Code ID UA-XX , the same thing will happen, no tracking when you start navigating.

        But if you use Tracking Code ID UA-XX , only, without putting GTM id's , it will track all pages you are navigating.

        7 days later

        So I added Tracking Code ID, now what? Where are the statistics? I don't see any changes in Admin,

          Anonymous43 which provider?

          For Google Analytics, visit the Google Analytics dashboard on google's domain.

          For Matomo, visit your Matomo instance. Optionally Matomo can be shown inside an iframe in the admin panel as described in the settings.

          So, it has absolutely nothing to do with flarum admin panel. In theory I can just view the stats from google without this extension.

            Anonymous43 yes, that's how it's intended to be used.

            The role of this extension is to perform the collection of the data. It's used instead the tracking code you usually paste in the header/footer. The code added by this extension tracks navigation inside of the single page app, which is not done if you just paste the code Google gives you.

            2 months later

            I can't see google analytics Tracking Code ID starting with " UA-XXXX" ...... I can only found the Tracking Code ID Like " G-XXXX " .

              2 months later

              Is it compatible with Flarum 1.2?
              Extiverse helper tells it is not 🙁

                almalino that was a temporary bug. The helper should now report things differently. Sorry for the confusion.

                7 days later
                9 days later

                matomo:
                Refused to display 'https://www.*****.com:9000/' in a frame because it set 'X-Frame-Options' to 'deny'.

                [General]
                enable_framed_pages=1

                无效

                3 months later

                r4nchy I have not studied the changes yet. Do you know whether it requires modifications to the javascript we embed in the extension?