Piwik\Plugins\Goals\API::updateGoal PHP Méthode

updateGoal() public méthode

Will not update or re-process the conversions already recorded
See also: addGoal() for parameters description
public updateGoal ( integer $idSite, integer $idGoal, $name, $matchAttribute, string $pattern, string $patternType, boolean $caseSensitive = false, boolean | float $revenue = false, boolean $allowMultipleConversionsPerVisit = false, string $description = '' ) : void
$idSite integer
$idGoal integer
$name
$matchAttribute
$pattern string
$patternType string
$caseSensitive boolean
$revenue boolean | float
$allowMultipleConversionsPerVisit boolean
$description string
Résultat void
    public function updateGoal($idSite, $idGoal, $name, $matchAttribute, $pattern, $patternType, $caseSensitive = false, $revenue = false, $allowMultipleConversionsPerVisit = false, $description = '')
    {
        Piwik::checkUserHasAdminAccess($idSite);
        $name = $this->checkName($name);
        $description = $this->checkDescription($description);
        $pattern = $this->checkPattern($pattern);
        $this->checkPatternIsValid($patternType, $pattern, $matchAttribute);
        $revenue = Common::forceDotAsSeparatorForDecimalPoint((double) $revenue);
        $this->getModel()->updateGoal($idSite, $idGoal, array('name' => $name, 'description' => $description, 'match_attribute' => $matchAttribute, 'pattern' => $pattern, 'pattern_type' => $patternType, 'case_sensitive' => (int) $caseSensitive, 'allow_multiple' => (int) $allowMultipleConversionsPerVisit, 'revenue' => $revenue));
        $this->getGoalsInfoStaticCache()->delete(self::getCacheId($idSite));
        Cache::regenerateCacheWebsiteAttributes($idSite);
    }

Usage Example

Exemple #1
0
    public function test_updateGoal_shouldUpdateMinimalFields_ShouldLeaveOtherFieldsUntouched()
    {
        $idGoal = $this->createAnyGoal();
        $this->api->updateGoal($this->idSite, $idGoal, 'UpdatedName', 'file', 'http://www.updatetest.de', 'contains');

        $this->assertGoal($idGoal, 'UpdatedName', 'file', 'http://www.updatetest.de', 'contains', 0, 0, 0);
    }