getTracking($scope)->getInstalledIndexes(); $configs = Request::processRequest('CustomDimensions.getConfiguredCustomDimensionsHavingScope', [ 'idSite' => $idSite, 'scope' => $scope, ]); foreach ($configs as $config) { $key = array_search($config['index'], $indexes); if ($key !== false) { unset($indexes[$key]); } } if (empty($indexes)) { throw new Exception("All Custom Dimensions for website $idSite in scope '$scope' are already used."); } $index = array_shift($indexes); return $index; } private function getTracking($scope) { return new LogTable($scope); } private function getConfiguration() { return new Configuration(); } }