diff --git a/CHANGELOG.md b/CHANGELOG.md index 6059a10291f6887b788ea1b61e56194789ac6d90..ab9e6c198b1b5cd884b6b105beb51befa09c1eff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,11 +15,12 @@ The Product Changelog at **[piwik.org/changelog](http://piwik.org/changelog)** l * Added JavaScript Tracker method `deleteCustomVariables` to delete all custom variables within a certain scope * The method `enableLinkTracking` can now be called several times to make Piwik aware of newly added links when your DOM changes * Added a new method `Piwik\Plugin\Report::getMetricNamesToProcessReportTotals()` that lets you define which metrics should show percentages in the table report visualization on hover. If defined, these percentages will be automatically calculated. +* The event `Tracker.newConversionInformation` now posts a new fourth parameter `$action` * New HTTP API method `UserCountry.getCountryCodeMapping` to get a list of used country codes to country names ### Changes * SMS provider now can define their credential fields by overwriting `getCredentialFields()`. This allows to have SMS providers that require more than only an API key. -* Therefor the MobileMessaging API method `setSMSAPICredential()` now takes the second parameter as an array filled with credentials (instead of a string containing an API key) +* Therefore the MobileMessaging API method `setSMSAPICredential()` now takes the second parameter as an array filled with credentials (instead of a string containing an API key) ## Piwik 3.0.1 diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php index bdb4efc7ad0ae67aaee49379bc405a9c0116971c..931359c37357a626177c175e182655f694346b13 100644 --- a/core/Tracker/Action.php +++ b/core/Tracker/Action.php @@ -234,6 +234,13 @@ abstract class Action $this->customFields[$field] = $value; } + public function getCustomField($field) + { + if (isset($this->customFields[$field])) { + return $this->customFields[$field]; + } + } + public function getCustomFields() { return $this->customFields; diff --git a/core/Tracker/GoalManager.php b/core/Tracker/GoalManager.php index 37219577327c9b9adcc45fef4f9ed86d5e9a545c..762d8d3a9267a8f7e8c3978d48ced3c4c0e8d60f 100644 --- a/core/Tracker/GoalManager.php +++ b/core/Tracker/GoalManager.php @@ -336,7 +336,7 @@ class GoalManager $recorded = $this->getModel()->updateConversion( $visitProperties->getProperty('idvisit'), self::IDGOAL_CART, $conversion); } else { - $recorded = $this->insertNewConversion($conversion, $visitProperties->getProperties(), $request); + $recorded = $this->insertNewConversion($conversion, $visitProperties->getProperties(), $request, $action); } if ($recorded) { @@ -676,7 +676,7 @@ class GoalManager $conversionDimensions = ConversionDimension::getAllDimensions(); $conversion = $this->triggerHookOnDimensions($request, $conversionDimensions, 'onGoalConversion', $visitor, $action, $conversion); - $this->insertNewConversion($conversion, $visitProperties->getProperties(), $request); + $this->insertNewConversion($conversion, $visitProperties->getProperties(), $request, $action); } } @@ -685,9 +685,11 @@ class GoalManager * * @param array $conversion * @param array $visitInformation + * @param Request $request + * @param Action|null $action * @return bool */ - protected function insertNewConversion($conversion, $visitInformation, Request $request) + protected function insertNewConversion($conversion, $visitInformation, Request $request, $action) { /** * Triggered before persisting a new [conversion entity](/guides/persistence-and-the-mysql-backend#conversions). @@ -701,10 +703,12 @@ class GoalManager * @param array $visitInformation The visit entity that we are tracking a conversion for. See what * information it contains [here](/guides/persistence-and-the-mysql-backend#visits). * @param \Piwik\Tracker\Request $request An object describing the tracking request being processed. + * @param Action|null $action An action object like ActionPageView or ActionDownload, or null if no action is + * supposed to be processed. * @deprecated * @ignore */ - Piwik::postEvent('Tracker.newConversionInformation', array(&$conversion, $visitInformation, $request)); + Piwik::postEvent('Tracker.newConversionInformation', array(&$conversion, $visitInformation, $request, $action)); $newGoalDebug = $conversion; $newGoalDebug['idvisitor'] = bin2hex($newGoalDebug['idvisitor']);