# Goals: Matomo Matomo Goals Get Goals ## Documentation Every goal defined on one site - one row per goal, empty where no goal is defined at all (measured live on this container before any goal existed on it). Read + insert; update and delete are open, see the remarks above. - Catalog: `Matomo` - Schema: `Goals` - Primary Keys: `idgoal` - Label: Matomo Goals Get Goals - Retrieve: True - Insert: True - Update: False - Delete: False ## Parameters of Table Function The following parameters can be used to control the behaviour of the table function `Goals`. A value must be provided at all times for required parameters, but optional parameters in general do not need to have a value and the execution will default to a pre-defined behaviour. Values can be specified by position and by name. In both cases, all parameters not specified will be evaluated using their default values. Value specification by position is done by listing all values from the first to the last needed value. For example: a `select * from table(value1, value2, value3)` on a table with four parameters will use the default value for the fourth parameter and the specified values for the first three. Value specification by name is done by listing all values that require a value. For example with `select * from table(name1 => value1, name3 => value3)` on the same table will use the default values for the second and fourth parameters and the specified values for the first and third. | Name | Data Type | Required | Default Value | Documentation | |---|:---:|:---:|:---:|---| | `id_site` | `number` | ☑ | | The Matomo site ID to list goal definitions for. | ## Columns of Table Function The columns of the table function `Goals` are shown below. Each column has an SQL data type. A new non-null value must be provided for every required column at all times during insert. | Name | Data Type | Label | Required | Documentation | |---|:---:|---|:---:|---| | `allow_multiple` | `int32` | | ☐ | Whether one visit can convert this goal more than once - Matomo's own 0/1 flag, not a Boolean. Matomo's own parameter is 'allowMultipleConversionsPerVisit', not just a different case of this column's own name. | | `case_sensitive` | `int32` | | ☐ | Whether the match is case-sensitive - Matomo's own 0/1 flag, not a Boolean. Matomo's own parameter is 'caseSensitive'. | | `deleted` | `int32` | | ☐ | Whether this goal has been deleted - Matomo's own 0/1 flag, not a Boolean; a deleted goal keeps its historical conversions but drops out of future tracking. Read-only: deleteGoal is not wired up, see the remarks above. | | `description` | `varchar2` | | ☐ | The goal's own description, blank unless one was entered when it was created. | | `event_value_as_revenue` | `int32` | | ☐ | Whether an event's own numeric value is counted as this goal's revenue when it converts - Matomo's own 0/1 flag, not a Boolean. Matomo's own parameter is 'useEventValueAsRevenue'. | | `idgoal` | `int32` | | ☐ | The ID of the goal - not globally unique, reused across sites (Goals/Model.php's own getNextIdGoal computes max(idgoal)+1 per site). Assigned by Matomo on insert, never written. | | `idsite` | `int32` | | ☐ | The Matomo site ID this goal belongs to. Matomo's own addGoal() takes it as 'idSite'. | | `match_attribute` | `varchar2` | | ☐ | What a hit is matched against to convert this goal, for instance 'url', 'title' or 'event_category'. Required on insert; Matomo's own parameter is 'matchAttribute'. | | `name` | `varchar2` | | ☐ | The goal's name, as entered when it was created. Required on insert. | | `pattern_type` | `varchar2` | | ☐ | How pattern is matched, for instance 'contains', 'exact' or 'regex'. Required on insert; Matomo's own parameter is 'patternType'. | | `pattern` | `varchar2` | | ☐ | The pattern match_attribute is matched against. Required on insert. | | `revenue` | `double` | | ☐ | The fixed revenue value attributed to one conversion of this goal, as configured on the goal itself - distinct from Goals.get's own revenue column, which is a summed metric rather than a per-goal setting. |