From 5d5c9ec54a9d1bfb25abf3d0e7cdb094bd57eaaa Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Tue, 15 Jul 2014 12:38:01 +0200 Subject: [PATCH] If you have multiple views on the same url they will be overwritten and only the last one will be returned by getAllSitesIds(). That's why restructuring the returned array to either have the id as a key or nesting id and url one layer deeper makes sense. --- src/Thujohn/Analytics/Analytics.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Thujohn/Analytics/Analytics.php b/src/Thujohn/Analytics/Analytics.php index 23d36ff..36ead2e 100644 --- a/src/Thujohn/Analytics/Analytics.php +++ b/src/Thujohn/Analytics/Analytics.php @@ -58,7 +58,7 @@ public function getAllSitesIds() { if (empty($this->site_ids)) { $sites = $this->service->management_profiles->listManagementProfiles("~all", "~all"); foreach($sites['items'] as $site) { - $this->site_ids[$site['websiteUrl']] = 'ga:' . $site['id']; + $this->site_ids[] = array('id' => 'ga:' . $site['id'], 'url' => $site['websiteUrl']); } }