我试图使用从GA中提取一些数据,包括用户选择的货币类型。
我有工作的PHP代码(隔离),但为了提取用户选定的货币数据,我需要提取用户的Google_Service_Analytics_Profile,总共需要3个in才能获得配置文件:$accountId、$webPropertyId、$profileId。
下面是我提取数据的PHP代码:
// Create a connection to the GA API service
$analytics = new Google_Service_Analytics($client);
// Select the GA profile using the provided IDs
$ga_profile = $analytics->management_profiles->get($input_data->account_id, $input_data->property_id, $input_data->profile_id);可以看到从源头,Google_Service_Analytics_ManagementProfiles_Resource::get()方法需要上面提到的三个ID。
我想使用嵌入式API向用户显示一个选择器,以允许他们选择我显示数据的配置文件,我打算将所选的ID发布到PHP代码中,这将从GA中提取数据并对其进行处理。
不幸的是,嵌入API返回的唯一ID似乎是“查看ID",我理解的是上面的$profileID,但我不知道如何找到剩余的$accountId和$webPropertyId ID,以便通过PHP提取”分析概要“。
我如何获得其余的身份证?
这里是我的HTML和JS:http://jsbin.com/naxiyomeko/1/edit?html,js,console,output
发布于 2015-03-28 16:24:15
我能够从Google ViewSelector中获得其余的I,使用change事件的以下Javascript:
viewSelector.on('change', function() {
ids = {}
ids['account_id'] = viewSelector.B.fb;
ids['property_id'] = viewSelector.HC.fb;
ids['profile_id'] = viewSelector.RF.fb;
// Do something with `ids` object here...
});更新的JS:http://jsbin.com/hirapupayi/1/edit?html,js,console,output
https://stackoverflow.com/questions/29277639
复制相似问题