You are here

function piwik_reports_get_goals in Piwik Reports 7.3

Same name and namespace in other branches
  1. 7.4 piwik_reports.module \piwik_reports_get_goals()

Return a list of goals active on selected site.

Parameters

string $token_auth: Piwik server token auth.

string $site: Selected site id.

Return value

array Goals returned from Piwik reports API.

1 call to piwik_reports_get_goals()
piwik_reports_reports in ./piwik_reports.pages.inc
Return the $form that handles piwik reports.

File

./piwik_reports.module, line 539
Defines features and functions common to Piwik Reports.

Code

function piwik_reports_get_goals($token_auth, $site) {

  // TODO: shall I cache this?
  $result = drupal_http_request(piwik_reports_get_url() . 'index.php?module=API&method=Goals.getGoals&idSite=' . (int) $site . '&format=JSON&token_auth=' . $token_auth);
  if (empty($result->data)) {
    $goals = array();
  }
  else {
    $goals = drupal_json_decode($result->data);
  }
  return $goals;
}