API - Add a manually triggered goal

Hi,

I’ve been trying a lot of different ways to add a manually triggered goal through the API, but I can’t seem to do it. The Goals.addGoal function doesn’t have any real documentation though…

http://dev.piwik.org/trac/wiki/API/Reference

Anyway, I tried for example:

?module=API&format=XML&token_auth=auth_key_here&idSite=1&method=Goals.addGoal&name=test&matchAttribute=msdanual&revenue=100&patternType=manual&pattern=none

But it still adds a goal with some sort of pattern. Is there a way to add an ONLY MANUALLY triggered goal through the API?

Thanks a million,

Monochrome

for a manual goal conversion, simply set

$matchAttribute = manually

You can find the documentation of each API function in the source code directly (at some point, we will provide this documentation in a website page too)
http://dev.piwik.org/trac/browser/trunk/plugins/Goals/API.php#L58

Here is the code snippet:

/**
 * Creates a Goal for a given website.
 *
 * @param int $idSite
 * @param string $name
 * @param string $matchAttribute 'url', 'title', 'file', 'external_website' or 'manually'
 * @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)
 * @return int ID of the new goal
 */

It’s a bug. I met the same issue. Here is my working call to create a new “goal”:

curl -i -X POST -d ‘module=API&method=Goals.addGoal&idSite=1&name=TestGoal1&description=TestGoalDescr&matchAttribute=manually&allowMultipleConversionsPerVisit=1&pattern=TESTPATTERN&patternType=contains&format=JSON&token_auth=’ https://MATOMO-URL.de/index.php

I wonder why i MUST set
pattern=TESTPATTERN
AND
patternType=contains
even though I set
matchAttribute=manually

The goal seams to be created correctly . Hence I would say: not critical.