Skip to content

Commit fb8667a

Browse files
Merge pull request #39 from simonschaufi/CustomDimensions
Add CustomDimensions Module
2 parents d72ad0d + fcd6df6 commit fb8667a

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

src/Piwik.php

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,6 +1434,105 @@ public function getTriggeredAlerts($idSites, $optional = [])
14341434
], $optional);
14351435
}
14361436

1437+
/**
1438+
* MODULE: Custom Dimensions
1439+
* The Custom Dimensions API lets you manage and access reports for your configured Custom Dimensions.
1440+
*/
1441+
1442+
/**
1443+
* Fetch a report for the given idDimension. Only reports for active dimensions can be fetched. Requires at least
1444+
* view access.
1445+
*
1446+
* @param int $idDimension
1447+
* @param array $optional
1448+
*
1449+
* @return bool|object
1450+
*/
1451+
public function getCustomDimension($idDimension, $optional = [])
1452+
{
1453+
return $this->_request('CustomDimensions.getCustomDimension', [
1454+
'idDimension' => $idDimension,
1455+
], $optional);
1456+
}
1457+
1458+
/**
1459+
* Configures a new Custom Dimension. Note that Custom Dimensions cannot be deleted, be careful when creating one
1460+
* as you might run quickly out of available Custom Dimension slots. Requires at least Admin access for the
1461+
* specified website. A current list of available `$scopes` can be fetched via the API method
1462+
* `CustomDimensions.getAvailableScopes()`. This method will also contain information whether actually Custom
1463+
* Dimension slots are available or whether they are all already in use.
1464+
*
1465+
* @param string $name The name of the dimension
1466+
* @param string $scope Either 'visit' or 'action'. To get an up to date list of available scopes fetch the
1467+
* API method `CustomDimensions.getAvailableScopes`
1468+
* @param int $active '0' if dimension should be inactive, '1' if dimension should be active
1469+
* @param array $optional
1470+
*
1471+
* @return bool|object
1472+
*/
1473+
public function configureNewCustomDimension($name, $scope, $active, $optional = [])
1474+
{
1475+
return $this->_request('CustomDimensions.configureNewCustomDimension', [
1476+
'name' => $name,
1477+
'scope' => $scope,
1478+
'active' => $active,
1479+
], $optional);
1480+
}
1481+
1482+
/**
1483+
* Updates an existing Custom Dimension. This method updates all values, you need to pass existing values of the
1484+
* dimension if you do not want to reset any value. Requires at least Admin access for the specified website.
1485+
*
1486+
* @param int $idDimension The id of a Custom Dimension.
1487+
* @param string $name The name of the dimension
1488+
* @param int $active '0' if dimension should be inactive, '1' if dimension should be active
1489+
* @param array $optional
1490+
*
1491+
* @return bool|object
1492+
*/
1493+
public function configureExistingCustomDimension($idDimension, $name, $active, $optional = [])
1494+
{
1495+
return $this->_request('CustomDimensions.configureExistingCustomDimension', [
1496+
'idDimension' => $idDimension,
1497+
'name' => $name,
1498+
'active' => $active,
1499+
], $optional);
1500+
}
1501+
1502+
/**
1503+
* @return bool|object
1504+
*/
1505+
public function getConfiguredCustomDimensions()
1506+
{
1507+
return $this->_request('CustomDimensions.getConfiguredCustomDimensions', [
1508+
]);
1509+
}
1510+
1511+
/**
1512+
* Get a list of all supported scopes that can be used in the API method
1513+
* `CustomDimensions.configureNewCustomDimension`. The response also contains information whether more Custom
1514+
* Dimensions can be created or not. Requires at least Admin access for the specified website.
1515+
*
1516+
* @return bool|object
1517+
*/
1518+
public function getAvailableScopes()
1519+
{
1520+
return $this->_request('CustomDimensions.getAvailableScopes', [
1521+
]);
1522+
}
1523+
1524+
/**
1525+
* Get a list of all available dimensions that can be used in an extraction. Requires at least Admin access
1526+
* to one website.
1527+
*
1528+
* @return bool|object
1529+
*/
1530+
public function getAvailableExtractionDimensions()
1531+
{
1532+
return $this->_request('CustomDimensions.getAvailableExtractionDimensions', [
1533+
]);
1534+
}
1535+
14371536
/**
14381537
* MODULE: CUSTOM VARIABLES
14391538
* Custom variable information

0 commit comments

Comments
 (0)