We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36931
    • 206 Posts
    Good evening,

    I just installed piwik plugin on Modx 2.5 Revo.
    https://modx.com/extras/package/piwikvisitssummary
    and then I was looking to get the token and seiteid. Then I wen tto piwik web site https://piwik.org/
    and I was surpised to not see a register link etc.

    I am wondering how can I setup a web site on piwik and to get the token, for MODx?
    [ed. note: pierrot1010 last edited this post 7 years, 2 months ago.]
      • 36448
      • 58 Posts
      Hi, at my opinion is this plugin not necessary - unless you need this at the modx dashboard (makes the backend slower).
      I prefer a small snippet for this and you need only the "PiwikTracker.php" file.
      Maybe it helps you?

      <?php
      //Snippet call e.g.: [[!PiwikTracker? &id=`7`]]
      
      //Sources:
      //http://piwik.org
      //http://piwik.org/docs/tracking-api/
      //http://developer.piwik.org/api-reference/PHP-Piwik-Tracker
      
      //Piwik Tracking API init:
      require_once 'PiwikTracker.php';
      PiwikTracker::$URL = 'http://YOUR-PIWIK-SITE.ltd';
      $piwikTracker = new PiwikTracker($idSite=$id);
      $piwikTracker->setTokenAuth('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
      
      //IP:
      $piwikTracker->setIP($_SERVER['REMOTE_ADDR']);
      
      //FullUrl:
      $resID = $modx->resource->get('id');
      $fullUrl = $modx->makeUrl($resID, '', '', 'full');
      $piwikTracker->setUrl($fullUrl);
      
      //PageTitle:
      $PageTitle = $modx->resource->get('pagetitle');
      $piwikTracker->doTrackPageView($PageTitle);
      
      return;
      
      [ed. note: krischel last edited this post 7 years, 2 months ago.]
        • 36931
        • 206 Posts
        Hello,
        Thank a lot for this, It's look very interesting.
        But how can I get a token. I am surprised, we can login/register from the piwik website.
        May be I missed it...

        Cheer
          • 36448
          • 58 Posts
          Quote from: pierrot1010 at Feb 06, 2017, 10:39 PM
          But how can I get a token
          Sorry, I am not sure if I understand you correct.
          Help about piwik and the token you can find here: piwik.org/faq/

            • 36931
            • 206 Posts
            Quote from: krischel at Feb 06, 2017, 10:48 PM
            Quote from: pierrot1010 at Feb 06, 2017, 10:39 PM
            But how can I get a token
            Sorry, I am not sure if I understand you correct.
            Help about piwik and the token you can find here: piwik.org/faq/

            Hello JO,
            The doc say:
            You can find the token_auth by logging in Piwik
            If I install the plugin, how can I loggin to pickwik if have not uploaded the package and run the installation.
            I also look at the Piwik website and there is no register or login link.

            If I use your suggestion, which look very nice, should I upload the piwik package and install first?
            If not, how can get a token without a login link....

            I am a bit confused. shocked)

            Thanka lot
            • To get the Piwik Auth Token, you have to log into a Piwik installation. This is not the PiwikVisitsSummary installation inside of MODX.

              Piwik has to be installed self hosted on your webhost by downloading Piwik and installing it. There is at least one not self hosted installation available with http://piwik.org/hosting/, but that's not for free.