public function addGoal($idSite, $name, $matchAttribute, $pattern, $patternType, $caseSensitive = false, $revenue = false, $allowMultipleConversionsPerVisit = false, $description = '',
                            $useEventValueAsRevenue = false)
    {
        Piwik::checkUserHasWriteAccess($idSite);

        $this->checkPatternIsValid($patternType, $pattern, $matchAttribute);
        $name        = $this->checkName($name);
        $pattern     = $this->checkPattern($pattern);
        $patternType = $this->checkPatternType($patternType);
        $description = $this->checkDescription($description);

        $revenue = Common::forceDotAsSeparatorForDecimalPoint((float)$revenue);

        $goal = array(
            'name'            => $name,
            'description'     => $description,
            'match_attribute' => $matchAttribute,
            'pattern'         => $pattern,
            'pattern_type'    => $patternType,
            'case_sensitive'  => (int)$caseSensitive,
            'allow_multiple'  => (int)$allowMultipleConversionsPerVisit,
            'revenue'         => $revenue,
            'deleted'         => 0,
            'event_value_as_revenue' => (int) $useEventValueAsRevenue,
        );

        $idGoal = $this->getModel()->createGoalForSite($idSite, $goal);

        $this->getGoalsInfoStaticCache()->delete(self::getCacheId($idSite));

        Cache::regenerateCacheWebsiteAttributes($idSite);
        return $idGoal;
    }