Eliminate session IDs from URLs

Many dynamic generated Websites are using session-IDs to track users. In this case a URL kooks like: domain.tld/site1.html?SID=12345678. But the SID is different for each visitor.

In actions/pages PIWIK shows ten lines with the same page (domain.tld/site1.html) with ten different session IDs. It would be a great feature if there were an option to eliminate everything in the URL starting at a userdefined character string like “?SID=”.

Result should be on line with a 10 times visited URL.

[size=8pt]__________________________________
Geldboersen - Geldbeutel - Kellnerboersen[/size]

Any idea how many variants we’d have to handle?

I have created a ticket in Trac for this issue. http://dev.piwik.org/trac/ticket/519

I´m using xt:commerce shop-software and I know about only two different strings possible after the URL. This would be ?=XTSid and ?=RefID. I don´t see the need for more than two strings per site, but I would suggest to have five fields where the admin can enter the relevant strings for his system.

I don´t know how Piwik handles tracking for multiple websites, but these fields should be separate for each website (different content management systen, different IDs)

Hello, I want keep my tracking via url, but ignore some GET var, for exemple:
http://ultracopier.first-world.info/forum/…b587e7ccb8466d8
I want ignore the “sid” var. Thanks to add it.

Yes, cleaning up the URL (e.g., removing session IDs) is desirable. I posed this earlier and as I recall, it was believed that server side filtering would add unnecessary load given the wide assortment of session ID var names (e.g., sid, PHPSESSID, …) and platform-specificity. (?)

So… I guess that means moving the filtering to the client (i.e., piwik.js). What would be a reasonable approach?

tracker.filterUrlParameters( array|string )

  • specify a string or array of strings containing var names to be removed from the URL

and/or

tracker.filterUrlParameters( function )

  • a user defined callback function to be called with the raw URL and which returns a clean URL

Secondly, should the referrer URL also be filtered?

I have put this code:
piwikTracker.filterUrlParameters([“sid”,“p”]);
In my tag. That’s should work?

I thinks some filter need by in js, other (like registred/owned site) in db for not change all tag on each modification.

[quote=alpha_one_x86 @ Jul 24 2009, 04:24 PM]I have put this code:
piwikTracker.filterUrlParameters([“sid”,“p”]);
In my tag. That’s should work?

I thinks some filter need by in js, other (like registred/owned site) in db for not change all tag on each modification.[/quote]
I’m proposing to add such a method – this isn’t in the API now, so don’t change your tracking code yet. That said, yes, that would be one example given the above proposal.

Sorry, I don’t quite follow the second part of your post.

Ok, I recalled incorrectly.

There is a proposal for a server-side plugin. (There’s even a code submission.) See: http://dev.piwik.org/trac/ticket/41

How user the code (where put it):

<?php
/**
 * Piwik - Open source web analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
 * @version $Id$
 *
 * @package Piwik_TidyUrl
 */

require_once "Tracker/Action.php";

class Piwik_TidyUrl_Tracker_Action extends Piwik_Tracker_Action {
        public function getActionName() {
                $actionName = parent::getActionName();
                $actionType = parent::getActionType();
                if ($actionType == 1) {
                        // remove tomcat jsession id
                        $actionName = preg_replace("/;jsessionid=[A-Za-z0-9\.]*/","",$actionName);
                        // remove seam conversation id (assuming always at end of url)
                        $actionName = preg_replace("/&conversationId=[0-9]*/","",$actionName);
                        $actionName = preg_replace("/\\?conversationId=[0-9]*/","",$actionName);
                }
                return $actionName;
        }
}

/**
 *
 * @package Piwik_TidyUrl
 */
class Piwik_TidyUrl extends Piwik_Plugin
{
    public function getInformation()
    {
        $info = array(
            'name' => 'TidyUrl',
            'description' => 'TidyUrl',
            'author' => 'ahus1',
            'homepage' => 'http://www.ahus1.de/',
            'version' => '0.1',
            'TrackerPlugin' => true, // this plugin must be loaded during the stats logging
        );

        return $info;
    }

    function getListHooksRegistered()
    {
        $hooks = array(
            'Tracker.newAction' => 'logTidyUrl',
        );
        return $hooks;
    }


    /**
     * URL Tidy
     */
    public function logTidyUrl($notification)
    {
            $action =& $notification->getNotificationObject();
            $action = new Piwik_TidyUrl_Tracker_Action();
    }

}

for try the plugin?

I haven’t tested it…

Save it as a file in plugins/TidyUrl/TidyUrl.php
and Activate it from your Settings | Plugins screen.

[quote=alpha_one_x86 @ Jul 24 2009, 07:37 PM]How user the code (where put it):

<?php
/**
 * Piwik - Open source web analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
 * @version $Id$
 *
 * @package Piwik_TidyUrl
 */

require_once "Tracker/Action.php";

class Piwik_TidyUrl_Tracker_Action extends Piwik_Tracker_Action {
        public function getActionName() {
                $actionName = parent::getActionName();
                $actionType = parent::getActionType();
                if ($actionType == 1) {
                        // remove tomcat jsession id
                        $actionName = preg_replace("/;jsessionid=[A-Za-z0-9\.]*/","",$actionName);
                        // remove seam conversation id (assuming always at end of url)
                        $actionName = preg_replace("/&conversationId=[0-9]*/","",$actionName);
                        $actionName = preg_replace("/\\?conversationId=[0-9]*/","",$actionName);
                }
                return $actionName;
        }
}

/**
 *
 * @package Piwik_TidyUrl
 */
class Piwik_TidyUrl extends Piwik_Plugin
{
    public function getInformation()
    {
        $info = array(
            'name' => 'TidyUrl',
            'description' => 'TidyUrl',
            'author' => 'ahus1',
            'homepage' => 'http://www.ahus1.de/',
            'version' => '0.1',
            'TrackerPlugin' => true, // this plugin must be loaded during the stats logging
        );

        return $info;
    }

    function getListHooksRegistered()
    {
        $hooks = array(
            'Tracker.newAction' => 'logTidyUrl',
        );
        return $hooks;
    }


    /**
     * URL Tidy
     */
    public function logTidyUrl($notification)
    {
            $action =& $notification->getNotificationObject();
            $action = new Piwik_TidyUrl_Tracker_Action();
    }

}

for try the plugin?[/quote]

This ist notworking for 0.5 what must i Change for Working?

plz help