Gather combined data from content with different URLs in Google Analytics

3

When collecting Google Analytics information for the local database, I end up consuming multiple requests for data relating to the same article on the web site.

This occurred due to the evolution of the same that is also reflected in changes in the URL:

# Query String
http://www.example.com/?modulo=artigos&chamada=ver&artigo=1

# Slugs
http://www.example.com/artigo/meu-artigo-fixe

# Sub-Domain
http://artigo.example.com/meu-artigo-fixe

With each article having three URLs, each one being in Google Analytics, the code below is executed 3 times, one for each URL, in order to obtain the desired information:

$service = new Google_AnalyticsService($client);

$gaProfileID = 'ga:xxxxxxxx';
$startDate = '2000-01-01';
$endDate = date("Y-m-d", time());
$metrics = 'ga:sessions,ga:pageviews,ga:percentNewVisits';
$optParams = array(
    "filters" => "ga:pagePath==/".$urlDoArtigo // multiplas chamadas porque este valor muda
);

$results = $service->data_ga->get($gaProfileID, $startDate, $endDate, $metrics, $optParams);

Question

How to get the data of each combined URL in a single call to Google Analytics?

$ga_sessions = 'totalSessõesDosTrêsUrls'
$ga_pageviews = 'totalSessõesDosTrêsUrls'
$ga_percentNewVisits = 'totalPercentagemNovasVisitasDosTrêsUrls'
    
asked by anonymous 16.04.2015 / 22:32

0 answers