I'm trying to extract data from my custom dimension and save to database.I tried this simple code.But I can't retrieve my custom data.I got this error "Unknown dimension:my custom dimension"
<?php
include_once(app_path().'/gapi.class.php');
$ga = new gapi('my email','my password');
$ga->requestReportData('my GA Id',array('my Custom dimension'),array('my custom metrics'));
foreach($ga->getResults() as $result)
{
echo $result;
}
?>
Does anyone have a solution to this problem?
It seems you are referring to your dimensions by name. Instead you should use ga:dimension
and a numeric index ( ga:dimension1
to ga:dimension20
). Similar for custom metrics.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.