【问题标题】:Can not retrieve pagePathLevel1 dimension无法检索 pagePathLevel1 维度
【发布时间】:2015-11-05 07:32:38
【问题描述】:

我正在尝试在此处检索 ga:pagePathLevel1 但出现错误

警告:array_merge():参数 #2 不是 ...\google-api-php-client\src\Google\Service\Analytics.php 上线 1925

function getResults(&$analytics, $profileId) {
  // Calls the Core Reporting API and queries for the number of sessions
  // for the last seven days.
  $analytica_report['data_ga_get'] = $analytics->data_ga->get(
      'ga:' . $profileId,
      '7daysAgo',
      'today',
 'ga:sessions,ga:pageviews,ga:uniquePageviews,ga:bounces,ga:timeOnPage,ga:sessionDuration,ga:entrances,ga:exits,ga:searchUniques,ga:transactions',
     'ga:pagePathLevel1,ga:pagePathLevel2'      
      );

任何人都可以建议我如何使它正确吗?

【问题讨论】:

    标签: php google-analytics-api google-api-php-client


    【解决方案1】:

    方法中的最后一个参数是可选参数。试试这样的

    $optParams = array(
          'dimensions' => 'ga:pagePathLevel1,ga:pagePathLevel2');
    
      return $service->data_ga->get(
          'ga:' . $profileId,
          '7daysAgo',
          'today',
          'ga:sessions,ga:pageviews,ga:uniquePageviews,ga:bounces,ga:timeOnPage,ga:sessionDuration,ga:entrances,ga:exits,ga:searchUniques,ga:transactions',
          $optParams);
    }
    

    您可能还会发现documentation 很有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-04
      • 2018-06-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多