Skip to content

Feature: Add CustomDimensions Module #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions src/Piwik.php
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,105 @@ public function getTriggeredAlerts($idSites, $optional = [])
], $optional);
}

/**
* MODULE: Custom Dimensions
* The Custom Dimensions API lets you manage and access reports for your configured Custom Dimensions.
*/

/**
* Fetch a report for the given idDimension. Only reports for active dimensions can be fetched. Requires at least
* view access.
*
* @param int $idDimension
* @param array $optional
*
* @return bool|object
*/
public function getCustomDimension($idDimension, $optional = [])
{
return $this->_request('CustomDimensions.getCustomDimension', [
'idDimension' => $idDimension,
], $optional);
}

/**
* Configures a new Custom Dimension. Note that Custom Dimensions cannot be deleted, be careful when creating one
* as you might run quickly out of available Custom Dimension slots. Requires at least Admin access for the
* specified website. A current list of available `$scopes` can be fetched via the API method
* `CustomDimensions.getAvailableScopes()`. This method will also contain information whether actually Custom
* Dimension slots are available or whether they are all already in use.
*
* @param string $name The name of the dimension
* @param string $scope Either 'visit' or 'action'. To get an up to date list of available scopes fetch the
* API method `CustomDimensions.getAvailableScopes`
* @param int $active '0' if dimension should be inactive, '1' if dimension should be active
* @param array $optional
*
* @return bool|object
*/
public function configureNewCustomDimension($name, $scope, $active, $optional = [])
{
return $this->_request('CustomDimensions.configureNewCustomDimension', [
'name' => $name,
'scope' => $scope,
'active' => $active,
], $optional);
}

/**
* Updates an existing Custom Dimension. This method updates all values, you need to pass existing values of the
* dimension if you do not want to reset any value. Requires at least Admin access for the specified website.
*
* @param int $idDimension The id of a Custom Dimension.
* @param string $name The name of the dimension
* @param int $active '0' if dimension should be inactive, '1' if dimension should be active
* @param array $optional
*
* @return bool|object
*/
public function configureExistingCustomDimension($idDimension, $name, $active, $optional = [])
{
return $this->_request('CustomDimensions.configureExistingCustomDimension', [
'idDimension' => $idDimension,
'name' => $name,
'active' => $active,
], $optional);
}

/**
* @return bool|object
*/
public function getConfiguredCustomDimensions()
{
return $this->_request('CustomDimensions.getConfiguredCustomDimensions', [
]);
}

/**
* Get a list of all supported scopes that can be used in the API method
* `CustomDimensions.configureNewCustomDimension`. The response also contains information whether more Custom
* Dimensions can be created or not. Requires at least Admin access for the specified website.
*
* @return bool|object
*/
public function getAvailableScopes()
{
return $this->_request('CustomDimensions.getAvailableScopes', [
]);
}

/**
* Get a list of all available dimensions that can be used in an extraction. Requires at least Admin access
* to one website.
*
* @return bool|object
*/
public function getAvailableExtractionDimensions()
{
return $this->_request('CustomDimensions.getAvailableExtractionDimensions', [
]);
}

/**
* MODULE: CUSTOM VARIABLES
* Custom variable information
Expand Down