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,


(Matthieu Aubry) #2

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)

(hightechguy) #3

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