Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

piwikTracker.setCustomData do nothing!!! help!! #1140

Closed
anonymous-matomo-user opened this issue Feb 8, 2010 · 6 comments
Closed

piwikTracker.setCustomData do nothing!!! help!! #1140

anonymous-matomo-user opened this issue Feb 8, 2010 · 6 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Milestone

Comments

@anonymous-matomo-user
Copy link

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
Copy link
Contributor

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

@anonymous-matomo-user
Copy link
Author

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
Copy link
Member

mattab commented Apr 7, 2011

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

@anonymous-matomo-user
Copy link
Author

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
Copy link
Member

mattab commented Sep 13, 2012

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
Copy link
Member

mattab commented Oct 19, 2012

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

@anonymous-matomo-user anonymous-matomo-user added this to the 1.9.2 - Piwik 1.9.2 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

3 participants