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

Example plugin to log (store), archive, retrieve, and display custom data #998

Closed
robocoder opened this issue Oct 8, 2009 · 7 comments
Closed
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

@robocoder
Copy link
Contributor

UPDATE

See ticket #1436 - which allows to track additional information about community users. It generates reports about:

* usertype (user/guest) including evolution
* users age-group
* evolution of average age
* gender (male, female, unknown) including evolution
* user activity (list of the most active user) 
@mattab
Copy link
Member

mattab commented Jan 18, 2010

vipsoft, this has indeed be one of the most asked questions. If you are keen to start on this, I can help you with dev.

@mattab
Copy link
Member

mattab commented Feb 11, 2010

Also, explain how to use the Updates in the plugin (ie. create a Updates/X.php where X is the version of the plugin upgraded to, that can contain php code and sql queries)

@anonymous-matomo-user
Copy link

It would be very helpful if you could just let us know which hook to use and what array the custom data is stored in. Thanks

@anonymous-matomo-user
Copy link

You can use "Tracker.Action.record". Here is some code from a plugin we made recently:

function getListHooksRegistered()
{
    return array(
        'Tracker.Action.record' => 'newAction',
    );
}

function newAction($action) {
    try {
        // This fills the $visitor_id variable with Piwik's visitor ID. There are also other variables which you can get access to, just print_r($action);
        $visitor_id = $action->_notificationInfo['idVisit'];
        $data = $action->_notificationObject->getRequest();
        $data = json_decode(stripslashes($data['data']));
    } catch (Exception $e) {
        return false;
    }
    // Can now access custom variables through $data->*, like so:
    $my_custom_variable = $data->my_var;
}

Hope this helps someone.

@mattab
Copy link
Member

mattab commented Jun 21, 2010

I'm tempted to mark this as fixed, considering the very nice plugin in: #1436

@robocoder
Copy link
Contributor Author

Agree!

@robocoder
Copy link
Contributor Author

(In [2420]) fixes #1457 - remove E_EXCEPTION (couldn't find any documentation for this as a predefined PHP constant)

refs #998 - merge upgrade.php and common.php so json_decode() is available to Tracker plugins; sync up with -17 release of upgradephp

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