API - Add a manually triggered goal


#1

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


(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)
http://dev.piwik.org/trac/browser/trunk/plugins/Goals/API.php#L58


(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
 */