php - Incorrect AVG Session Duration? -
i setting google analytics api functions, average session duration doesn't seem correct. typical average session duration 4:10 getting numbers such 1144 (seconds) or 24.06 minutes. way off know happening here? read incorrect date reference. using. users, sessions, , pageviews much less should well.
$from = date('y-m-d', time() - 1 24 60 60); // "yesterday" "today" -- ' - d h m s ' change (d) day go further (1) day $to = date('y-m-d'); // today $metrics = 'ga:users,ga:pageviews,ga:bounces,ga:sessions,ga:sessionduration,ga:totalevents,ga:transactions,ga:transactionrevenue,ga:avgsessionduration'; $dimensions = 'ga:date,ga:eventcategory,ga:eventaction,ga:eventlabel,ga:devicecategory'; $sort = "-ga:sessions"; $data = $analytics->data_ga->get('ga:' . $ga_profile_id, $from, $to, $metrics, array('dimensions' => $dimensions, 'sort' => $sort, 'samplinglevel' => 'higher_precision')); ga:users 229 ga:pageviews 2118 ga:bouncerate 0 ga:sessions 229 ga:sessionduration 262079.0 ga:avgsessionduration 19.074163027656 (calculated minutes) ga:transactions 40 ga:transactionrevenue 2756.63 ga:totalevents 452
expected data
users: ~15000
pageviews: ~64000
bounce rate: ~47.5%
sessions: ~17500
average session duration: ~4 minutes 10 seconds
transactions: ~780
transaction revenue: ~50000
total events: ~350-400
so lower should except events
events interesting dimension type -- there no (not set) value, if session has event exists no value event category, event action or event label, session excluded report.
try same query without event dimensions, add them 1 @ time see causing data loss.
Comments
Post a Comment