gepex
gepex

Reputation: 197

GAPI missing couple number in visitors

I'm using GAPI library and I'm having problems retreiving the unique visits from general information of my site. (not pageviews or anything)

For visits I'm using:

$ga->requestReportData(ga_profile_id,array('userDefinedValue'),array('visits'), $sort_metric=null, $filter=null, $start_date,$end_date,$start_index=1,$max_results=100);

echo $ga->getVisits();

And work perfect, giving me the exact number.

And for the unique visits:

$ga->requestReportData(ga_profile_id,array('userDefinedValue'),array('visitors'), $sort_metric=null, $filter=null, $start_date,$end_date,$start_index=1,$max_results=100);

echo $ga->getVisitors(); //gives me 771.047

Which gives me ALMOST the same number, which should be 797.731.

Not sure what im doing wrong, hope you can help, thank you.

Upvotes: 0

Views: 103

Answers (1)

gepex
gepex

Reputation: 197

OK, i found the solution,

for the dimension I have to use "day" instead of "userDefinedValue

    $ga->requestReportData(ga_profile_id,array('day'),array('visitors'), $sort_metric=null, $filter=null, $start_date,$end_date,$start_index=1,$max_results=100);

echo $ga->getVisitors(); //gives me the correct answer

Upvotes: 0

Related Questions