API - Add a manually triggered goal


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…


Anyway, I tried for example:


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,


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)

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
even though I set

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