Click here if you want to read this article for the latest Piwik version

Piwik\Columns\

Dimension

Since Piwik 2.5.0

Properties

This abstract class defines the following properties:

  • $columnName — This will be the name of the column in the database table if a $columnType is specified.
  • $columnType — If a columnType is defined, we will create a column in the MySQL table having this type.

$columnName

This will be the name of the column in the database table if a $columnType is specified.

Signature

  • It is a string value.

$columnType

If a columnType is defined, we will create a column in the MySQL table having this type.

Please make sure MySQL understands this type. Once you change the column type the Piwik platform will notify the user to perform an update which can sometimes take a long time so be careful when choosing the correct column type.

Signature

  • It is a string value.

Methods

The abstract class defines the following methods:

addSegment()

Adds a new segment.

The segment type will be set to 'dimension' automatically if not already set.

Signature

  • It accepts the following parameter(s):

  • It does not return anything.

getName()

Get the translated name of the dimension.

Defaults to an empty string.

Signature

  • It returns a string value.

getId()

Returns a unique string ID for this dimension.

The ID is built using the namespaced class name of the dimension, but is modified to be more human readable.

Signature

  • Returns: string — eg, "Referrers.Keywords"
  • It throws one of the following exceptions:
    • Exception — if the plugin and simple class name of this instance cannot be determined. This would only happen if the dimension is located in the wrong directory.

getAllDimensions()

Gets an instance of all available visit, action and conversion dimension.

Signature

getDimensions()

Signature

  • It accepts the following parameter(s):

  • It does not return anything.

factory()

Creates a Dimension instance from a string ID (see getId()).

Signature

  • It accepts the following parameter(s):

    • $dimensionId (string) — See getId().
  • Returns: Dimension|null — The created instance or null if there is no Dimension for $dimensionId or if the plugin that contains the Dimension is not loaded.

getModule()

Returns the name of the plugin that contains this Dimension.

Signature

  • It returns a string value.
  • It throws one of the following exceptions:
    • Exception — if the Dimension is not located within a Plugin module.