@anonymous-piwik-user opened this Issue on February 8th 2010

Hello.
I read on this page http://piwik.org/docs/javascript-tracking/
this:
Send custom JSON data to the piwik.php tracking scripts (plugins developers)

For example, sending user ID data in an (imaginary) user tracking plugin:

[...]
var user = { 'userId' : user_id( i put my user_id) };
piwikTracker.setCustomData( user );
piwikTracker.trackPageView();
[...]

But 2 problemes
1: a seen anaywhere en database where customdata had save.
2: I find anywhere what API&method call to get this data.

Thanks for answer.
Keywords: piwikTracker.setCustomData

@robocoder commented on February 8th 2010 Contributor

Not in Piwik core. You'll have to write a plugin or wait for #998.

@anonymous-piwik-user commented on February 8th 2010

Not in Piwik core. You'll have to write a plugin or wait for #998.
1 what tell you can do this if can't do!!!!
2 at #998 there nothing
3 So it'is no in core neither in dev version? refert at 1

@mattab commented on April 7th 2011 Owner

just in case you're still interested this is now possible with Custom Variables

@anonymous-piwik-user commented on September 12th 2012

Custom Variables are limited to 5 and would get overrwritten if the data changes for every page.

Track.Action.record event is triggered when action is record. However the name of the action need to be URL + data which happens much earlier.

Following fix to core helped me get around.

File: core/Tracker/Action.php

    protected function extractUrlAndActionNameFromRequest() {
        //...
        if(empty($actionType)) {

            // ...
            // remove empty categories
            $split = array_filter($split, 'strlen');

            // Wrokaround: Append data parameter if sent by piwikTracker.trackPageView()
            $data = Piwik_Common::getRequestVar( 'data', '', 'json', $this->request);
            if ($data) {
                $url .= "&data=" . urlencode(json_encode($data));
            }
            // END

            // rebuild the name from the array of cleaned categories
            $actionName = implode($actionCategoryDelimiter, $split);
        }
        // ...
@mattab commented on September 13th 2012 Owner

Cna you please send a standard patch / diff file ? see: http://piwik.org/participate/development-process/#toc-how-to-submit-a-patch

Thank you for the report and the fix!

@mattab commented on October 19th 2012 Owner

please comment if your patch is important & works & you'd like us to consider commit it. Thanks!

This Issue was closed on October 19th 2012
Powered by GitHub Issue Mirror