We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21838
    • 284 Posts
    Hi all,

    can you give me some hints on how I can add URI strings with a plugin to a MODX Revo site?
    It’s all about user tracking with a custom PIWIK-setup in this case, we’re working on a FURL site.

    Are there any special things to worry about or already presets?
    thanks,
    -Anselm
      MODX Free Template Base: MODX-Boilerplate | my blog (lots of MODX stuff) | my gitHub (translations) | MODX User Groups Germany (Facebook)
      • 33968
      • 863 Posts
      Hi novolo

      I didn’t understand exactly what you are trying to do, could you explain a little more? What do you mean by URI strings... something like query strings appended to the page URL?
        • 21838
        • 284 Posts
        Quote from: lucas at Jul 02, 2011, 10:56 AM

        I didn’t understand exactly what you are trying to do, could you explain a little more? What do you mean by URI strings... something like query strings appended to the page URL?
        We have an existing site structure and URIs like http://site.url.com/myuri/1
        And now we want to track campaigns (extensively) with PIWIK. That means we have several parameters and a hash-parameters to the URL/URI which means we have a structure like http://site.url.com/myuri/1?param=xyz&ext=123#has=true&this=false
        Parameters and hashes come from piwik and should be in MODX on pageload (or sth. like that).
          MODX Free Template Base: MODX-Boilerplate | my blog (lots of MODX stuff) | my gitHub (translations) | MODX User Groups Germany (Facebook)
          • 33968
          • 863 Posts
          From my experience with Google Analytics + AdWords, campaign tracking is usually just a matter of manually adding campaign-specific params to the link in your campaign (email newsletter, banner ad, external links, etc). Piwik seems to use a similar technique - see the URL Builder.

          A quick look at Piwik’s Campaign Tracking docs confirm that the params are only required for the first page view when the campaign visitor arrives at your site. Piwik will register that visitor as a Campaign visitor and continue tracking as normal. There’s no need to use a plugin or snippet and the params should work fine with FURLs enabled.

          I think you’ll just need to ensure that there are no conflicts with any snippets you use which also add parameters to the url (getPage, for example).

          Please excuse me if I’ve missed the point here smiley
            • 21838
            • 284 Posts
            Solved this issue logically. Thanks for our input, lucas.

            But for my own interest, the initial solution…: I set a parameter to the URL which links to my MODX site. If this parameter is set, MODX should show a completely other template + ressource than without this parameter.
            When has the plugin to be set? OnWebPagePrerender / OnLoad? How can I set this ressource change based on GET parameter in best practice?

            thanks,
            -anselm
              MODX Free Template Base: MODX-Boilerplate | my blog (lots of MODX stuff) | my gitHub (translations) | MODX User Groups Germany (Facebook)
              • 33968
              • 863 Posts
              I’m not entirely sure either - would love to see some kind of flow diagram showing the order in which all the system events fire in Revolution. I think sottwell had produced a nice run though for Evo.

              Have you tried OnHandleRequest, with something like this:
              <?php
              $param = $_GET['url_param'];
              
              if (isset($param)) {
                      $modx->sendForward(5);   // resource you want to show if params set
              }
              


              You might want to do some validation in there to check the correct param value is there. sendForward grabs the contents of the new document (in this case 5) and renders them in the current page without changing the URL.
                • 21838
                • 284 Posts
                Thank you. Will try later. Seems to work best on OnHandleRequest from what I’ve found out.
                  MODX Free Template Base: MODX-Boilerplate | my blog (lots of MODX stuff) | my gitHub (translations) | MODX User Groups Germany (Facebook)
                  • 33968
                  • 863 Posts
                  No problem at all, let us know how it goes.

                  I’m keen to hear your thoughts on Piwik too - I’ve not tried it out but it looks like a reasonable alternative to Google Analytics.
                    • 21838
                    • 284 Posts
                    Quote from: lucas at Jul 02, 2011, 02:39 PM

                    I’m keen to hear your thoughts on Piwik too - I’ve not tried it out but it looks like a reasonable alternative to Google Analytics.
                    I use it on several sites where clients not wanted to have Google Analytics explicitly. UI is not as comfortable as GA in some cases but you can extend it for your own use-cases.
                    In this case we modified the code to get HTML5 offline tracking for an App.
                      MODX Free Template Base: MODX-Boilerplate | my blog (lots of MODX stuff) | my gitHub (translations) | MODX User Groups Germany (Facebook)