Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (19)

View Page History
{zone-data:milestones}
* Milestone 1: \[DONE\]Create Proposal
* Milestone 2: \[IN PROGRESS\]Create \[DONE\]Create Class Skeletons
* Milestone 3: \[DONE\]Code working prototype
* Milestone 4: Working prototype checked into the incubator
* Milestone 5: Write unit tests

{zone-data:use-cases}
||UC-01||
||UC-01: simple account feed request||
{code}
require_once 'Zend/Gdata/ClientLogin.php';
{code}

||UC-02||
||UC-02: data feed request using data query||
{code}
require_once 'Zend/Gdata/ClientLogin.php';
require_once 'Zend/Gdata/Analytics.php';

$email = 'somebody@example.com';
$password = 'p455w0rd';

$client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, Zend_Gdata_Analytics::AUTH_SERVICE_NAME);
$service = new Zend_Gdata_Analytics($client);

$query = $service->getDataQuery(); $service->newDataQuery()
->setProfileId(123456)
->addDimension(Zend_Gdata_Analytics_DataQuery::DIMENSION_MEDIUM)
->addDimension(Zend_Gdata_Analytics_DataQuery::DIMENSION_SOURCE)
->addMetric(Zend_Gdata_Analytics_DataQuery::METRIC_BOUNCES)
->addMetric(Zend_Gdata_Analytics_DataQuery::METRIC_VISITS)
->setFilter(Zend_Gdata_Analytics_DataQuery::DIMENSION_MEDIUM."==referral")
->setStartDate('2008-10-01')
->setEndDate('2008-10-31')
->setSort(Zend_Gdata_Analytics_DataQuery::METRIC_VISITS, true)
->setMaxResults(25);
$query->addDimension(Zend_Gdata_Analytics_DataQuery::DIMENSION_USER_DEFINED_VALUE)
$result = $service->getDataFeed($query);

echo "ga:source\tga:medium\tga:visits\tga:bounces\n";
foreach($result as $row){
echo $row->getDimension(Zend_Gdata_Analytics_DataQuery::DIMENSION_SOURCE)."\t"; // default dimension
echo $row->getDimension('ga:medium')."\t"; // dimensions using string instead of constant
echo $row->getMetric('ga:visits')."\t"; // metrics only
echo $row->getValue('ga:bounces')."\t"; // alternative using getValue
->addMetric(Zend_Gdata_Analytics_DataQuery::METRIC_GOAL_1_COMPLETE) echo "\n";
->setStartDate('2009-12-01')
->setEndDate('2009-12-31')
->setOrder(Zend_Gdata_Analytics_DataQuery::METRIC_GOAL_1_COMPLETE, Zend_Gdata_Analytics_DataQuery::ORDER_DESC);
$result = $service->getDataFeed($query);
// ...
}
{code}
{zone-data}
* Returns a new DataQuery object.
*
* @return Better_Gdata_Analytics_DataQuery Zend_Gdata_Analytics_DataQuery
*/
public function newDataQuery();
}
{code}

||Zend_Gdata_Analytics_DataQuery||
{code}
}
{code}
{zone-data}

||Zend_Gdata_Analytics_DataFeed||
{code}
class Zend_Gdata_Analytics_DataFeed extends Zend_Gdata_Feed {

/**
* The classname for individual feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_Analytics_DataEntry';
/**
* The classname for the feed.
*
* @var string
*/
protected $_feedClassName = 'Zend_Gdata_Analytics_DataFeed';

public function __construct($element = null);
}
{code}

||Zend_Gdata_Analytics_DataEntry||
{code}
class Zend_Gdata_Analytics_DataEntry extends Zend_Gdata_Entry {

protected $_dimensions = array();
protected $_metrics = array();

public function __construct($element = null);

/**
* @param DOMElement $child
*/
protected function takeChildFromDOM($child);

/**
* @return string
*/
public function getDimension($dimension);

/**
* @return string
*/
public function getMetric($metric);

/**
* @return string
*/
public function getValue($name);
}
{code}

||Zend_Gdata_Analytics_AccountFeed||
{code}
class Zend_Gdata_Analytics_AccountFeed extends Zend_Gdata_Feed {

/**
* The classname for individual feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_Analytics_AccountEntry';
/**
* The classname for the feed.
*
* @var string
*/
protected $_feedClassName = 'Zend_Gdata_Analytics_AccountFeed';

public function __construct($element = null);
}
{code}

||Zend_Gdata_Analytics_AccountEntry||
{code}
class Zend_Gdata_Analytics_AccountEntry extends Zend_Gdata_Entry {

protected $_accountId;
protected $_accountName;
protected $_profileId;
protected $_webPropertyId;
protected $_currency;
protected $_timezone;
protected $_tableId;

public function __construct($element = null);

/**
* @param DOMElement $child
*/
protected function takeChildFromDOM($child);
}
{code}
{zone-data}
{zone-template-instance}