We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13428 ☆ A M B ☆
    • 1,031 Posts
    On some customer websites I use Piwik as software for web analytics. The following MODx module (version 0.6.5) displays a few Piwik widgets in the MODx backend and the corresponding plugin inserts the suitable code for Piwik at the end of the html code generated by MODx.

    The base of the module/plugin is an installation of Piwik. PiwikX depends on this software.

    First download the packed files of the module and upload them to /assets/modules/piwikx.

    Then you have to create a new plugin called PiwikX and paste the plugin code into it (piwikx.plugin.txt).

    Now you have to create a new module and paste the following module code into it (piwikx.module.txt).

    The module can be called now after reloading the MODx manager. Since the module is not yet configured, a summary page with the minimal and the complete configuration will be displayed. One of these configurations must be inserted in the module configuration and the settings have to changed according to the corresponding Piwik installation. As an example the minimal configuration is shown here:

    &piwikURL=URL to your Piwik installation;text;http://your.piwik.installation
    &piwikSiteId=Piwik Site ID;text;1
    &piwikUsername=Username to display the Piwik widgets;text;
    &piwikPassword=md5 encrypted password to display the Piwik widgets;text;

    piwikURL contains the url of the Piwik installation.

    piwikSiteId contains the id of the website inside of piwik (Admin settings -> Sites).

    piwikUsername contains the name of a new user inside of piwik (Admin settings -> Users). This user has to have viewing acces for the website to track.

    piwikPassword is the md5 encrypted password of this user.

    piwikActionName contains the name of a template or document variable. The content of this variable will be parsed (contained snippet calls will be executed and document or template variables will be replaced – snippets have to be called cached und template variables should be called as in page templates) and used as tracking title for Piwik. If this option is not set, the pagetitle will be used as tracking title.

    piwikUserExclude and piwikGroupExclude could contain a comma-separated list of user names and/or web groups. These users and/or groups will be excluded from piwik tracking if they are logged into the MODx frontend or backend.

    After that you have to enable parameter sharing in the module configuration and add the PiwikX plugin in the dependencies of the module.

    The module should display now a few Piwik widgets in the MODx backend. The configuration of these widgets could be set in the file <language>.managerwidgets.php – a small howto for modifications in this file is written in the german documentation.

    Now you have to select PiwikX in import module shared parameters of the PiwikX plugin configuration and activate OnParseDocument as system event for the plugin. After saving the plugin the Piwik code will be inserted at the end of the html code generated by MODx. Since this code is enclosed in a DIV with the class piwik, it could be hidden by .piwik { display: none } in the CSS file.

    Hope my english is understandable.

    Future (bugfix) versions of the module could be found at:
    http://www.partout.info/piwik_modx_en.html or http://www.partout.info/piwik_modx.html

    The next release (planned features: full configuration by module page – widgets too) will be published in the repository.

    Regards
    Jako
      • 4971
      • 964 Posts
      Beautiful... I will give it a try...

      I installed Piwik on Friday as a replacement to Woopra which does not seem to work and
      uses a ton of javascript. 

      I am using it as a complement to Google Analytics.

      I placed the Piwik (and GA and woopra) scripts in the footer using a TV

      Thanks... I let you know how it goes...
        Website: www.mercologia.com
        MODX Revo Tutorials:  www.modxperience.com

        MODX Professional Partner
        • 33992 ☆ A M B ☆
        • 455 Posts
        So nice! very useful and beautiful addon.
        I’ve tried it!
          God loves me. 【ツ】


          MODX.ir (Persian Support)

          Boplo.ir/modx/ (Persian)
          • 7231
          • 4,205 Posts
          Very interesting. I will check this out. Thanks grin grin
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don&#39;t know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 20289
            • 958 Posts
            Nice addition and thanks Piwik ossa!
              [img]http://i10.tinypic.com/52c4eir.gif[/img][/td]
              [td][Wiki] [Persian support forum]
              [SVN] [RTL SVN Branch] [bugs] [FishEye+Crucible] [Learn MODx!] | [My Google Code]
              [font=tahoma][برای دسترسی به راهنمای فارسی به [url=http://www.modxcms.ir]
              • 9207 ☆ A M B ☆
              • 2,475 Posts
              Ooo.... I think you need to update your instructions...

              When you say "URL to your Piwik installation"... what do you mean? My web site domain? The full domain and path to the assets folder where I uploaded the piwik stuff? Ack... this is confusing.

              Piwik Site ID? What’s that?

              md5 encrypted password to display the Piwik widgets? You mean I should go into MySQL and copy and paste the md5 encrypted hash for my password? What?!


              I can offer some clarifications...
              After copying and pasting the text from piwikx.plugin.txt and piwikw.module.txt into a plugin and a module respectively, you should logout of the MODx manager, then log back in. Now go to the Modules tab and you should see the PiwikX module. If you click on the PiwikX link, however, you will be confused.... instead, click on the Manage Modules link and then click on the Piwik module. This enables you to add your configuration details to the module.

              Go to the PiwikX’s configuration tab and paste in the following text, BUT MAKE SURE that all the elements are on one line!!!


              &piwikURL=URL to your Piwik installation;text;http://your.piwik.installation
              &piwikSiteId=Piwik Site ID;text;1
              &piwikUsername=Username to display the Piwik widgets;text;
              &piwikPassword=md5 encrypted password to display the Piwik widgets;text;  
              

              What events does the Plugin have to listen to?

              Now, to load the configuration, click on the General tag, then click back on the Configuration tab. POOF, a form should have been generated based on the text you just pasted into the "Module configuration" field.


              Sie können rühig auf Deutsch schreiben... nur daß wir Ihnen verstehen können.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                you should logout of the MODx manager, then log back in. Now go to the Modules tab and you should see the PiwikX module

                Depending on your browser, you can also right-click on the top menu bar and choose "reload this frame", or even just reload the whole page. That is my fault; when I added the modules item to the main menu it didn’t occur to me to auto-refresh the menu bar when adding/deleting a module!
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 13428 ☆ A M B ☆
                  • 1,031 Posts
                  Hey, did you really read the whole installation instructions? The whole parameters you are asking for were described below of the minimal parameters box on this page. The plugin event is mentioned at the end of this page and in the plugin code too.

                  The base of the module/plugin is an installation of Piwik.
                  Maybe I should write ’a separate installation’. PiwikX and Piwik are not the same thing.

                  The module can be called now after reloading the MODx manager.
                  Firefox and Safari will display the Module Link without logout/login just by reloading the manager.

                  Quote from: Everett at May 06, 2009, 11:12 PM

                  Go to the PiwikX’s configuration tab and paste in the following text, BUT MAKE SURE that all the elements are on one line!!!
                  With Firefox and Safari, I had no problem posting the parameter code on different lines. Maybe I should test this once more.
                    • 9207 ☆ A M B ☆
                    • 2,475 Posts
                    Hey, did you really read the whole installation instructions?

                    Yes, I did. I even read them in German to make sure I wasn’t missing something in translation.

                    piwikURL could be something like "http://www.mydomain.com" or it could be "www.mydomain.com" or it could be "http:www.mydomain.com/assets/modules/pikwikx/" -- saying that it "contains the url of the Piwik installation" doesn’t really tell me what I need to put in there. You really should include the full example and explain what it is. Is it just the root of the site? Is it the specific folder? Yes, you should clarify whether it is the installation of piwikx or piwik you’re talking about. Either way, I’ve played around with this for about an hour and I can’t make anything work.

                    piwikSiteId -- you mention Admin settings --> Sites. I don’t see that menu anywhere. Where is that supposed to be? In the MODx manager? Is it in some desktop application that I was supposed to have downloaded? Is it some command line utility running elsewhere on my web server? Am I supposed to see the Admin menu item somewhere? What is the site id supposed to be? An integer? Can it be anything? Is it usually 1? Can I name it a string? Why are there multiple ids? I only have one site.... was I supposed to run and install a full version of Piwik and then this module allows access to that code? Or does the PiwikX code contain everything I need to get the reports I want?


                    piwikUsername -- you mention "Admin settings --> Users" but I still don’t see that anywhere...

                    piwikPassword -- same confusion here. Why do I have to paste the password? Am I looking up an existing password hash? Or am I creating a new password? If I am creating a new password, why not label the form as "create new password" and then use PHP’s md5() function? If I’m pasting an existing password, where am I copying this from? From the database? If yes, what query am I running? Which table and column am I selecting from? If I’m not supposed to be logging into MySQL’s command line... then am I supposed to be in the GUI somewhere? In the Admin settings menu (which I still don’t see). I need more guidance here.

                    piwikActionName -- this really needs explanation. I didn’t see any examples of Snippets anywhere... only modules and plugins. What does a Snippet call look like?

                    You should mention the "OnParseDocument" event when you’re talking about pasting code into a new plugin. If people need to disable the plugin at first, that’s fine, but it’s weird to paste in code for a plugin and have no event for it... at least, that left me feeling like I was waiting for the other shoe to drop, and by the time I figure out what’s wrong with my module configuration (days later), I’m probably not going to remember which event the plugin was supposed to listen to... I would be more likely to remember to turn it on, though.

                    As for the elements needing to be on one line: with Safari 3.2.1 on OS X 10.4.11, everything needed to be on one line, otherwise only the first configuration item would load.

                    Regarding logging out/logging in the manager... yes, I know there are ways around it, but it’s a sure thing if you logout and log back in... I just said that because I’ve had clients get really confused with this and ultimately it’s just an easier and more thorough instruction.

                    Sorry I’m such a nag. I just have a real talent for taking every instruction out of context, so I need them to be absolutely clear. I hope my questions make your work on this great module available to more people. Thanks.
                      • 13428 ☆ A M B ☆
                      • 1,031 Posts
                      I’ll try to write a more detailed version of the documentation.

                      The event of the plugin is set in the last moment because of setting the sharing parameters with the module. The plugin won’t work before and there is no way to edit the plugin only once. Because you have to set the depencies in the module to an existing plugin. And without the depencies it is not possible to activate sharing parameters in the plugin. I thougt this way would be the fastest.