Ticket #998 (closed New feature: wontfix)

Opened 3 years ago

Last modified 13 months ago

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

Reported by: vipsoft Owned by:
Priority: normal Milestone: Piwik 0.8 - A Web Analytics platform
Component: New Plugin Keywords:
Cc: Sensitive: no

Description (last modified by matt) (diff)

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)

Change History

Changed 3 years ago by vipsoft

  • summary changed from Example plugin to log (store), archive, and retrieve custom data to Example plugin to log (store), archive, retrieve, and display custom data

Changed 3 years ago by vipsoft

  • description modified (diff)

Changed 2 years ago by matt

  • milestone changed from 2 - Piwik 0.6 - DigitalVibes to 3 - Piwik 0.8 - A Web Analytics platform

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.

Changed 2 years ago by matt

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)

Changed 2 years ago by abowman

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

Changed 2 years ago by Telogis

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.

Changed 2 years ago by matt

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

Changed 2 years ago by vipsoft

  • status changed from new to closed
  • resolution set to wontfix

Agree!

Changed 23 months ago by vipsoft

(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

Changed 23 months ago by matt

  • description modified (diff)

Changed 13 months ago by sple007

Note: See TracTickets for help on using tickets.