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;
    }
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;
    }
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 ; }
Creates a Goal for a given website.

@param int $idSite
@param string $name
@param string $matchAttribute 'url', 'title', 'file', 'external_website', 'manually', 'event_action', 'event_category' or 'event_name'
@param string $pattern eg. purchase-confirmation.htm
@param string $patternType 'regex', 'contains', 'exact'
@param bool $caseSensitive
@param bool|float $revenue If set, default revenue to assign to conversions
@param bool $allowMultipleConversionsPerVisit By default, multiple conversions in the same visit will only record the first conversion.
If set to true, multiple conversions will all be recorded within a visit (useful for Ecommerce goals)
@param string $description
@return int ID of the new goal
Creates a Goal for a given website .